Linux下Nginx配置多个站点
配置多站点实际就是一个主配置文件, 多个子配置文件, 然后在主配置文件中include子配置文件的路径即可
建立文件夹:eg. /
root/wwwroot即: 站点目录建立
vhost文件夹(/usr/local/nginx/conf/vhost)在
vhost下创建配置文件name.confserver {
listen 80;
server_name IP;
root /home/wwwroot/test;
location / {
index index.html index.htm index.php;
#autoindex on;
}
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;
}
}配置主配置文件
nginx.confhttp{
....
include vhost/*.conf;
}

浙公网安备 33010602011771号