系统环境Ubuntu 14.04 x86。
我之前是完全按照VPS-Ubuntu中文这篇文章的方法来从头配置Nginx主机,可是当我在"/etc/nginx/sites-enabled/"目录下放入另外一个域名的信息的时候,都无法配置成功,使用“service nginx restart”重启Nginx服务的时候也都是失败(Fail)……
VPS上“/etc/nginx/sites-enabled/”目录下有“default”和“*.xxx.com”两个配置文件,代码分别如下:
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; } }是不是我这样配置有冲突造成配置失败的呢?请教一下应该如何正确配置?
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。