0

我有一个正在运行的 openWRT,并且我已经在上面安装了 nginx。Nginx 在端口 80 上运行得非常好。为了避免 /etc/config/uhttpd 中的冲突,我将端口从 80 更改为 89,但是当我在 Web 浏览器中打开它时,我得到的是“index of /”而不是Luci的网页界面。这里可能有什么错误?

先感谢您。

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 配置

# 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";  
4

2 回答 2

0

由于 LEDE 论坛用户所做的工作,现在 Nginx 上的 LuCI 成为可能。

于 2016-09-11T15:39:19.827 回答
0

OpenWrt nginx 软件包附带的默认 nginx.conf 仅包含以下内容:

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

默认情况下,您的 LUCI 索引文件位于下方,/www因此请检查您的 /etc/nginx/nginx.conf 是否正确设置为您的 LUCI 索引文件。如果您的 LUCI 文件位于默认位置,那么您的 nginx.conf 应包含以下内容:

        location / {
        root   /www;
        }

不要忘记应用更改:nginx -s reload

于 2015-08-23T12:57:46.797 回答