我有一个NGINX的问题,这很可能是一个简单的修复,然后再次不能是我只是不知道那么多关于NGINX。
我有我的NGINXconfiguration下面这很好。 但我有3个其他的硬盘与相同的脚本设置的子域。 所以长话短说我需要添加更多的侦听服务器,我猜,我有www1.example.com作为第一个域名
然后我有www2.example.com等每个子域是在自己的硬盘驱动器,我需要指向nginx的每个硬盘驱动器。 有没有办法将其添加到NGINXconfiguration?
这是configuration文件。
#user nobody; worker_processes 4; worker_rlimit_nofile 30000; worker_rlimit_sigpending 32768; error_log logs/error.log error; #pid logs/nginx.pid; events { worker_connections 4096; } http { include mime.types; default_type application/octet-stream; access_log off; limit_conn_log_level info; #sendfile on; #tcp_nopush on; reset_timedout_connection on; server_tokens off; autoindex off; keepalive_timeout 0; #keepalive_timeout 65; limit_conn_zone $binary_remote_addr zone=one:10m; perl_modules perl; perl_require download.pm; server { listen 182; server_name example.com; proxy_set_header X-Real-IP $remote_addr; #charset koi8-r; location /nstatus { stub_status on; #allow 127.0.0.1; #deny all; } location / { root html; index index.html index.htm; } location /d/ { perl download::handler; } # Free location /download_f/ { alias /example.com/uploads/; internal; set $limit_rate $arg_speed; limit_conn one 5; } # Registered location /download_r/ { alias /example.com/uploads/; internal; set $limit_rate $arg_speed; limit_conn one 5; } # Premium location /download_p/ { alias /example.com/uploads/; internal; set $limit_rate $arg_speed; limit_conn one 10; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } server { listen 182; server_name 2.example.com; proxy_set_header X-Real-IP $remote_addr; #charset koi8-r; location /nstatus { stub_status on; #allow 127.0.0.1; #deny all; } location / { root html; index index.html index.htm; } location /d/ { perl download::handler; } # Free location /download_f/ { alias /2.example.com/uploads/; internal; set $limit_rate $arg_speed; limit_conn one 5; } # Registered location /download_r/ { alias /2.example.com/uploads/; internal; set $limit_rate $arg_speed; limit_conn one 5; } # Premium location /download_p/ { alias /2.example.com/uploads/; internal; set $limit_rate $arg_speed; limit_conn one 10; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
你在你的server块中缺less一个root指令。 所以我不希望你现有的网站没有问题的工作。
至于添加更多的网站,只需创build更多的server块。