VPS侦探论坛

 找回密码
 注册
查看: 5051|回复: 3

lnmp1.1按教程设置404页面还回状态码200

[复制链接]
发表于 2015-1-19 21:10:09 | 显示全部楼层 |阅读模式

https://bbs.vpser.net/thread-2175-1-1.html 按教程这个设置的
还回200是不正常吧?
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2015-1-19 21:12:19 | 显示全部楼层


  1. user  www www;

  2. worker_processes auto;

  3. error_log  /home/wwwlogs/nginx_error.log  crit;

  4. pid        /usr/local/nginx/logs/nginx.pid;

  5. #Specifies the value for maximum file descriptors that can be opened by this process.
  6. worker_rlimit_nofile 51200;

  7. events
  8.         {
  9.                 use epoll;
  10.                 worker_connections 51200;
  11.                 multi_accept on;
  12.         }

  13. http
  14.         {
  15.                 include       mime.types;
  16.                 default_type  application/octet-stream;

  17.                 server_names_hash_bucket_size 128;
  18.                 client_header_buffer_size 32k;
  19.                 large_client_header_buffers 4 32k;
  20.                 client_max_body_size 50m;

  21.                 sendfile on;
  22.                 tcp_nopush     on;

  23.                 keepalive_timeout 60;

  24.                 tcp_nodelay on;

  25.                 fastcgi_connect_timeout 300;
  26.                 fastcgi_send_timeout 300;
  27.                 fastcgi_read_timeout 300;
  28.                 fastcgi_buffer_size 64k;
  29.                 fastcgi_buffers 4 64k;
  30.                 fastcgi_busy_buffers_size 128k;
  31.                 fastcgi_temp_file_write_size 256k;
  32.                 fastcgi_intercept_errors on;

  33.                 gzip on;
  34.                 gzip_min_length  1k;
  35.                 gzip_buffers     4 16k;
  36.                 gzip_http_version 1.0;
  37.                 gzip_comp_level 2;
  38.                 gzip_types       text/plain application/x-javascript text/css application/xml;
  39.                 gzip_vary on;
  40.                 gzip_proxied        expired no-cache no-store private auth;
  41.                 gzip_disable        "MSIE [1-6]\.";

  42.                 #limit_conn_zone $binary_remote_addr zone=perip:10m;
  43.                 ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.

  44.                 server_tokens off;
  45.                 #log format
  46.                 log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
  47.              '$status $body_bytes_sent "$http_referer" '
  48.              '"$http_user_agent" $http_x_forwarded_for';

  49. server
  50.         {
  51.                 listen 80 default;
  52.                 #listen [::]:80 default ipv6only=on;
  53.                 server_name www.lnmp.org;
  54.                 index index.html index.htm index.php;
  55.                 root  /home/wwwroot/default;

  56.                 #error_page   404   /404.html;
  57.                 location ~ [^/]\.php(/|$)
  58.                         {
  59.                                 # comment try_files $uri =404; to enable pathinfo
  60.                                 try_files $uri =404;
  61.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  62.                                 fastcgi_index index.php;
  63.                                 include fastcgi.conf;
  64.                                 #include pathinfo.conf;
  65.                         }

  66.                 location /nginx_status {
  67.                         stub_status on;
  68.                         access_log   off;
  69.                 }

  70.                 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  71.                         {
  72.                                 expires      30d;
  73.                         }

  74.                 location ~ .*\.(js|css)?$
  75.                         {
  76.                                 expires      12h;
  77.                         }

  78.                 access_log  /home/wwwlogs/access.log  access;
  79.         }
  80. include vhost/*.conf;
  81. }
复制代码
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2015-1-19 21:13:53 | 显示全部楼层

  1. server
  2.         {
  3.                 listen 80;
  4.                 #listen [::]:80;
  5.                 server_name www.shuijingba.cn shuijingba.cn;
  6.                 index index.php index.html index.htm default.html default.htm default.php;
  7.                 root  /home/wwwroot/www.shuijingba.cn;
  8.                 error_page 404 = /404.html;

  9.                 include discuzx.conf;
  10.                 #error_page   404   /404.html;
  11.                 location ~ [^/]\.php(/|$)
  12.                         {
  13.                                 # comment try_files $uri =404; to enable pathinfo
  14.                                 try_files $uri =404;
  15.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  16.                                 fastcgi_index index.php;
  17.                                 include fastcgi.conf;
  18.                                 #include pathinfo.conf;
  19.                         }

  20.                 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  21.                         {
  22.                                 expires      30d;
  23.                         }

  24.                 location ~ .*\.(js|css)?$
  25.                         {
  26.                                 expires      12h;
  27.                         }

  28.                 access_log off;
  29.         }
复制代码
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2015-1-20 09:33:27 | 显示全部楼层



配置文件里默认已经给你写上开启404的方法了,去掉注释就行了,你加的是错的
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-17 11:18 , Processed in 0.026622 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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