一:nginx.conf 主文件配置(/opt/nginx/conf/nginx.conf)
user www www;
worker_processes 4;}
二:nginx_site.conf(/opt/nginx/conf/vhost/nginx_site.conf)
server{
listen 80;
server_name www.88888888.com 88888888.com;
#include rewrite.conf;
#charset utf-8;
root /var/www/site;
index index.php index.html index.htm;
location ~ .*\.(php|php5)?$ {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
#root /var/www/site;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /var/www/site$fastcgi_script_name;
# include fastcgi_params;
}
location /status {
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 12h;
}
access_log off;
location ~ /\.ht {
deny all;
}
}
三:nginx_fly.conf(/opt/nginx/conf/vhost/nginx_fly.conf)
server{
listen 80;
server_name fly.88888888.com;
#include rewrite.conf;
#charset utf-8;
root /var/www/union;
index index.php index.html index.htm;
location ~ .*\.(php|php5)?$ {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /var/www/site$fastcgi_script_name;
# include fastcgi_params;
}
location /status {
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 12h;
}
access_log off;
location ~ /\.ht {
deny all;
}
}
参考:http://www.ha97.com/5194.html 配置文件详解