server {
listen 80 default_server;
listen [::]:80 default_server;
listen 443 ssl;
server_name ~^(.*?).mysite.com$; #注:~ 不能省
ssl_certificate /usr/share/nginx/html/mysite/ca/mysite.cer;
ssl_certificate_key /usr/share/nginx/html/mysite/ca/mysite.key;
set $sub $1;
###二级域名,wap.mysite.com
if ($sub ~* 'wap') {
rewrite ^/$ /Wap/UserLogin/login last;
}
root /usr/share/nginx/html/mysite;
index index.php index.html index.htm;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
error_log /usr/share/nginx/logs/error.log error;
location ~ /\.ht {
deny all;
}
location ~ .+\.php($|/) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
}
}