nginx.conf
server {
listen 80;
server_name ~^(en|kr).xxx.com ~^img(\d+).ml.xxx.com;
root 本地项目与nginx根节点一致的位置;
index index.php index.html index.htm;
#access_log logs/host.access.log main;
location /status {
stub_status on;
access_log off;
}
error_page 404 /error404.php;
location ~\.(zip|rar)$ {
deny all;
break;
}
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php last;
}
location / {
if (-f $request_filename) {
expires max;
break;
}
gzip_proxied any;
gzip_min_length 0;
gzip_buffers 4 8k;
gzip_types text/css text/xml text/plain image/png application/x-javascript;
gzip_vary on;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 1h;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
fastcgi_pass 192.168.13.185:9000; // 本地的Linux地址
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME linux上项目所在的位置$fastcgi_script_name;
include fastcgi_params;
}
}