0

I have an openWRT running and I have installed nginx on it. Nginx is running perfectly fine on port 80. In order to avoid conflict in the /etc/config/uhttpd I have changed port from 80 to 89, but when I open it in a web browser, I get "index of /" instead of web interface of Luci. What might be the mistake here?

Thank you in advance.

Nginx.conf

user nobody nogroup;
worker_processes  1;

error_log  logs/error.log;

events {
    worker_connections  1024;
}

http {
    include mime.types;
    index index.php index.html index.htm;
    default_type text/html;

    sendfile on;
    keepalive_timeout 65;
    gzip on;    
    gzip_buffers     4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_types       text/plain application/x-javascript text/css application/xml;
    gzip_vary on;
    gzip_min_length  1k;

    server {
        listen  80; # слушающий порт
        server_name  192.168.1.1; # имя или ip-адрес сервера
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
        fastcgi_buffer_size 32k;
        fastcgi_buffers 4 32k;
        fastcgi_busy_buffers_size 32k;
        fastcgi_temp_file_write_size 32k;
        client_body_timeout 10;
        client_header_timeout 10;
        send_timeout 60;
        output_buffers 1 32k;
        postpone_output 1460;
        root   /www/wifi;       # Папка с файлами сайта

        location ~ \.php$ {
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;

            if (-f $request_filename) {
                fastcgi_pass    127.0.0.1:1026; 
            }
        }
    }
}

uhttpd config

# Server configuration                                     
config uhttpd main                                         

        # HTTP listen addresses, multiple allowed          
        list listen_http        0.0.0.0:89                 
#       list listen_http        [::]:80                    

        # HTTPS listen addresses, multiple allowed         
        list listen_https       0.0.0.0:443                
#       list listen_https       [::]:443                   

        # Server document root                                  
        option home             /www                            

        # Reject requests from RFC1918 IP addresses             
        # directed to the servers public IP(s).                 
        # This is a DNS rebinding countermeasure.               
        option rfc1918_filter 1                                 

        # Maximum number of concurrent requests.                
        # If this number is exceeded, further requests are      
        # queued until the number of running requests drops     
        # below the limit again.                                
        option max_requests 3                                   

        # Certificate and private key for HTTPS.                
        # If no listen_https addresses are given,               
        # the key options are ignored.                          
        option cert             /etc/uhttpd.crt                 
        option key              /etc/uhttpd.key                 

        # CGI url prefix, will be searched in docroot.          
        # Default is /cgi-bin                                   
        option cgi_prefix       /cgi-bin                        


        # List of extension->interpreter mappings.         
        # Files with an associated interpreter can         
        # be called outside of the CGI prefix and do       
        # not need to be executable.                       
#       list interpreter        ".php=/usr/bin/php-cgi"    
#       list interpreter        ".cgi=/usr/bin/perl"       

        # Lua url prefix and handler script.               
        # Lua support is disabled if no prefix given.      
#       option lua_prefix       /luci                      
#       option lua_handler      /usr/lib/lua/luci/sgi/uhttpd.lua

        # CGI/Lua timeout, if the called script does not        
        # write data within the given amount of seconds,        
        # the server will terminate the request with            
        # 504 Gateway Timeout response.                         
        option script_timeout   60                              

        # Network timeout, if the current connection is         
        # blocked for the specified amount of seconds,          
        # the server will terminate the associated              
        # request process.                                      
        option network_timeout  30                              

        # TCP Keep-Alive, send periodic keep-alive probes       
        # over established connections to detect dead peers.    
        # The value is given in seconds to specify the          
        # interval between subsequent probes.                   
        # Setting this to 0 will disable TCP keep-alive.        
        option tcp_keepalive    1                               

        # Basic auth realm, defaults to local hostname          
#       option realm    OpenWrt                                 

        # Configuration file in busybox httpd format            
#       option config   /etc/httpd.conf                         


# Certificate defaults for px5g key generator                   
config cert px5g                                                

        # Validity time                                         
        option days             730                             

        # RSA key size                                          
        option bits             1024                        

        # Location                                          
        option country          DE                          
        option state            Berlin                      
        option location         Berlin                      

        # Common name                                       
        option commonname       OpenWrt    

php.ini

doc_root = "YOUR/DOCUMENT/ROOT"
cgi.force_redirect = 1
cgi.redirect_status_env = "yes";  

2 Answers 2

0

The default nginx.conf which comes with OpenWrt nginx packages only contains this:

        location / {
        root   html;
        index  index.html index.htm;
        }

And by default your LUCI index file is under /www so please check whether your /etc/nginx/nginx.conf is correctly set to your LUCI index file. If your LUCI files are on the default location then your nginx.conf should include this:

        location / {
        root   /www;
        }

Don't forget to apply changes with: nginx -s reload

2
0

LuCI on Nginx is now possible, thanks to work done by LEDE forum users.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.