因为配置不高(5G硬盘、512M内存),所以打算使用Nginx来搭建服务器而非Apache。
按照教程一步步做下来都挺顺利的,但是我想配置多域名到另外一个文件夹的时候,
每次把写好的文件放入“/etc/nginx/sites-enabled/”文件夹后,用
代码: 全选
service nginx restart
去掉其他的配置文件之后才能重启Nginx成功。 想问问这个问题大家是怎么处理的,还是说我的哪些设置上可能有问题?
跪求大神解答,先谢谢了~
=-=-=-=-=-=-=-=-=
这里是sites-enabled文件夹下default的设置
代码: 全选
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www;
index index.html index.htm index.php;
server_name *.*.*.*(主机所在IP地址);
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
if (!-e $request_filename)
{
rewrite ^/(.+)$ /index.php last;
}
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
}
}
代码: 全选
server {
listen 80;
server_name *.xxx.com;
index index.html index.htm index.php;
root /var/www/*/;
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
}
}