VPS侦探论坛

 找回密码
 注册
查看: 4744|回复: 4

问题已解决,谢谢军哥

[复制链接]
发表于 2013-10-13 02:34:37 | 显示全部楼层 |阅读模式

按照这个帖子https://bbs.vpser.net/viewthread.php?tid=2175&highlight=404

做完404设置之后,用/usr/local/nginx/sbin/nginx -t 测试结果如下:
  1. nginx: [warn] conflicting server name "xxx.com" on 0.0.0.0:80, ignored
  2. nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
  3. nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
复制代码
下面两段提示 是成功了吧?

但是第一段提示我没明白,搜索了一下貌似是重复添加了域名?但是我没在哪里添加过啊?也没有添加多余的配置文件,只是修改了nginx.conf和www.xxx.com.conf文件。测试就出现了这个问题。
之前做了301,这次做404


另外使用/usr/local/nginx/sbin/nginx -s reload重启也出现了这个问题:
  1. nginx: [warn] conflicting server name "xxx.com" on 0.0.0.0:80, ignored
复制代码


[ 本帖最后由 408904199 于 2013-10-13 02:47 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2013-10-13 02:35:56 | 显示全部楼层

www.xxx.com.conf虚拟主机文件




  1. server
  2. {
  3.   listen       80;
  4.   server_name www.xxx.com xxx.com;
  5.   index index.html index.htm index.php default.html default.htm default.php;
  6.   root  /home/wwwroot/www.xxx.com;
  7.   error_page 404 /404.html;  include discuzx.conf;
  8.   location ~ .*\.(php|php5)?$
  9.    {
  10.     try_files $uri =404;
  11.     fastcgi_pass  unix:/tmp/php-cgi.sock;
  12.     fastcgi_index index.php;
  13.     include fcgi.conf;
  14.    }  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  15.    {
  16.     expires      30d;
  17.    }  location ~ .*\.(js|css)?$
  18.    {
  19.     expires      12h;
  20.    }  access_log off;
  21. }
  22. server {
  23. server_name xxx.com;
  24. return 301 $scheme://www.xxx.com$request_uri;
  25. }
复制代码
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2013-10-13 02:37:15 | 显示全部楼层

nginx.conf文件


  1. user  www www;worker_processes 1;error_log  /home/wwwlogs/nginx_error.log  crit;pid        /usr/local/nginx/logs/nginx.pid;#Specifies the value for maximum file descriptors that can be opened by this process.
  2. worker_rlimit_nofile 51200;events
  3. {
  4.   use epoll;
  5.   worker_connections 51200;
  6. }http
  7. {
  8.   include       mime.types;
  9.   default_type  application/octet-stream;  server_names_hash_bucket_size 128;
  10.   client_header_buffer_size 32k;
  11.   large_client_header_buffers 4 32k;
  12.   client_max_body_size 50m;  sendfile on;
  13.   tcp_nopush     on;  keepalive_timeout 60;  tcp_nodelay on;  fastcgi_connect_timeout 300;
  14.   fastcgi_send_timeout 300;
  15.   fastcgi_read_timeout 300;
  16.   fastcgi_buffer_size 64k;
  17.   fastcgi_buffers 4 64k;
  18.   fastcgi_busy_buffers_size 128k;
  19.   fastcgi_temp_file_write_size 256k;
  20.   fastcgi_intercept_errors on;  gzip on;
  21.   gzip_min_length  1k;
  22.   gzip_buffers     4 16k;
  23.   gzip_http_version 1.0;
  24.   gzip_comp_level 2;
  25.   gzip_types       text/plain application/x-javascript text/css application/xml;
  26.   gzip_vary on;
  27.   gzip_proxied        expired no-cache no-store private auth;
  28.   gzip_disable        "MSIE [1-6]\.";  #limit_zone  crawler  $binary_remote_addr  10m;  server_tokens off;
  29.   #log format
  30.   log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
  31.              '$status $body_bytes_sent "$http_referer" '
  32.              '"$http_user_agent" $http_x_forwarded_for';server
  33. {
  34.   listen       80;
  35.   server_name www.lnmp.org;
  36.   index index.html index.htm index.php;
  37.   root  /home/wwwroot/default;  location ~ .*\.(php|php5)?$
  38.    {
  39.     try_files $uri =404;
  40.     fastcgi_pass  unix:/tmp/php-cgi.sock;
  41.     fastcgi_index index.php;
  42.     include fcgi.conf;
  43.    }  location /status {
  44.    stub_status on;
  45.    access_log   off;
  46.   }  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  47.    {
  48.     expires      30d;
  49.    }  location ~ .*\.(js|css)?$
  50.    {
  51.     expires      12h;
  52.    }  access_log  /home/wwwlogs/access.log  access;
  53. }
  54. include vhost/*.conf;
  55. }
复制代码
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2013-10-13 02:45:47 | 显示全部楼层



以解决 是以前301时候的遗留问题,看了军哥之前的回复,问题解决了

[ 本帖最后由 408904199 于 2013-10-13 02:47 编辑 ]
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2013-10-13 02:46:08 | 显示全部楼层

谢谢军哥 问题已解决

军哥运维代购:http://shop63846532.taobao.com/

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-25 03:22 , Processed in 0.026243 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表