nginx每个站点创建独立的配置文件
环境[*]nginx1.5.2
配置
[*]nginx的配置安装可以查看俺的另一篇文章:http://qingbofish.iyunv.com/blog/1917611
[*]打开nginx.conf文件,在http的最下面添加以下代码:
server_names_hash_bucket_size 64;
include E:/wnmp/nginx/vhosts/*.conf;
[*] 在ngxin文件夹内创建“vhosts”文件夹
[*]例如:域名1 example1.com 放在 E:/wnmp/www/example1
[*]在vhosts文件夹内创建:example1.com.conf文件,内容如下:
[*]
server {
listen80;
server_nameexample1.koolbao.com;
root E:/wnmp/www/example1;
#access_log/www/access_ example1.logmain;
location / {
indexindex.php index.html index.htm;
#autoindex on;#如果文件不存在列出目录结构;
}
error_page 500 502 503 504/50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;
include fastcgi_params;
}
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
location ~ /\.ht {
denyall;
}
}
好了,见证奇迹的时刻到了。
页:
[1]