Nginx:多个站点配置
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
upstream nmxlnn {
#server 47.93.176.32:8183 weight=1 max_fails=3 fail_timeout=2 down;
server 39.105.84.32:80 weight=200 max_fails=3 fail_timeout=2;
}
server {
listen 8088;
server_name localhost;
root /usr/share/nginx/html/nmxln1;
index index.php index.html;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
if (!-e $request_filename) {
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
server {
listen 8089;
server_name localhost;
root /usr/share/nginx/html/nmxln2;
index index.php index.html;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
if (!-e $request_filename) {
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html/nmxln;
index index.php index.html;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
if (!-e $request_filename) {
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
}