VPS侦探论坛

 找回密码
 注册
查看: 7658|回复: 5

nginx伪静态设置问题劳烦大家帮帮忙

[复制链接]
发表于 2011-6-18 17:02:01 | 显示全部楼层 |阅读模式

VPS的伪静态问题尝试过N次 也失败过N次问题是这样的,我的网站之前已经成功开启伪静态,因为绑定了多个域名,想取消一些域名 只用一个域名访问,所以就从新执行 /root/vhost.sh 添加虚拟主机命令 然后绑定了域名,之后伪静态怎么设置都是404错误!下面贴出 nginx.conf 文件设置详细信息:看看是否设置正确


  1. user  www www;
  2. worker_processes 1;
  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. }
  12. http
  13. {
  14.   include       mime.types;
  15.   default_type  application/octet-stream;
  16.   server_names_hash_bucket_size 128;
  17.   client_header_buffer_size 32k;
  18.   large_client_header_buffers 4 32k;
  19.   client_max_body_size 50m;
  20.   sendfile on;
  21.   tcp_nopush     on;
  22.   keepalive_timeout 60;
  23.   tcp_nodelay on;
  24.   fastcgi_connect_timeout 300;
  25.   fastcgi_send_timeout 300;
  26.   fastcgi_read_timeout 300;
  27.   fastcgi_buffer_size 64k;
  28.   fastcgi_buffers 4 64k;
  29.   fastcgi_busy_buffers_size 128k;
  30.   fastcgi_temp_file_write_size 256k;
  31.   gzip on;
  32.   gzip_min_length  1k;
  33.   gzip_buffers     4 16k;
  34.   gzip_http_version 1.0;
  35.   gzip_comp_level 2;
  36.   gzip_types       text/plain application/x-javascript text/css application/xml;
  37.   gzip_vary on;
  38.   #limit_zone  crawler  $binary_remote_addr  10m;
  39. server
  40. {
  41.                 listen       80;
  42.                 server_name down.7cds.info;
  43.                 index index.html index.htm index.php;
  44.                 root  /home/wwwroot;
  45. rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
  46. rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
  47. rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
  48. rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
  49. rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
  50. rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
  51. rewrite ^([^\.]*)/([a-z]+)-(.+)\.html$ $1/$2.php?rewrite=$3 last;
  52. if (!-e $request_filename) {
  53. return 404;
  54. }
  55.   location ~ .*\.(php|php5)?$
  56.    {
  57.     fastcgi_pass  unix:/tmp/php-cgi.sock;
  58.     fastcgi_index index.php;
  59.     include fcgi.conf;
  60.    }

  61.   location /status {
  62.    stub_status on;
  63.    access_log   off;
  64.   }

  65.   location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  66.    {
  67.     expires      30d;
  68.    }
  69.   location ~ .*\.(js|css)?$
  70.    {
  71.     expires      12h;
  72.    }
  73.   log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
  74.              '$status $body_bytes_sent "$http_referer" '
  75.              '"$http_user_agent" $http_x_forwarded_for';
  76.   access_log  /home/wwwlogs/access.log  access;
  77. }
  78. include vhost/*.conf;
  79. }
复制代码

[ 本帖最后由 1vs1good 于 2011-6-18 17:03 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2011-6-18 18:51:25 | 显示全部楼层


/usr/local/nginx/sbin/nginx -t 看一下
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2011-6-18 18:58:30 | 显示全部楼层

the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful

测试OK  但就是启动不了伪静态 我用的是DX1.5  
安装了lnmp0.7
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2011-6-18 19:05:07 | 显示全部楼层



之前按照这个方法 成功开启伪静态
昨天晚上从新执行 /root/vhost.sh 命令  覆盖了以前的虚拟主机!路径都是跟原来的一样~是不是这个地方出来问题
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2011-6-18 20:21:44 | 显示全部楼层

可能是吧,检查检查你的伪静态看看

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

发表于 2011-6-19 12:23:46 | 显示全部楼层

老兄你写错了奥。要写在location location /{}里面的啊,不然他不知道你要请求的是什么的啊。。。晕死了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-20 19:38 , Processed in 0.026327 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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