1vs1good 发表于 2011-6-18 17:02:01

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

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


userwww www;
worker_processes 1;
error_log/home/wwwlogs/nginx_error.logcrit;
pid      /usr/local/nginx/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
events
{
use epoll;
worker_connections 51200;
}
http
{
include       mime.types;
default_typeapplication/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m;
sendfile on;
tcp_nopush   on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
gzip on;
gzip_min_length1k;
gzip_buffers   4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types       text/plain application/x-javascript text/css application/xml;
gzip_vary on;
#limit_zonecrawler$binary_remote_addr10m;
server
{
                listen       80;
                server_name down.7cds.info;
                index index.html index.htm index.php;
                root/home/wwwroot;
rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
rewrite ^([^\.]*)/article-(+)-(+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
rewrite ^([^\.]*)/forum-(\w+)-(+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
rewrite ^([^\.]*)/thread-(+)-(+)-(+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^([^\.]*)/group-(+)-(+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
rewrite ^([^\.]*)/(+)-(.+)\.html$ $1/$2.php?rewrite=$3 last;
if (!-e $request_filename) {
return 404;
}
location ~ .*\.(php|php5)?$
   {
    fastcgi_passunix:/tmp/php-cgi.sock;
    fastcgi_index index.php;
    include fcgi.conf;
   }

location /status {
   stub_status on;
   access_log   off;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
   {
    expires      30d;
   }
location ~ .*\.(js|css)?$
   {
    expires      12h;
   }
log_formataccess'$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';
access_log/home/wwwlogs/access.logaccess;
}
include vhost/*.conf;
}


[ 本帖最后由 1vs1good 于 2011-6-18 17:03 编辑 ]

licess 发表于 2011-6-18 18:51:25

/usr/local/nginx/sbin/nginx -t 看一下

1vs1good 发表于 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

1vs1good 发表于 2011-6-18 19:05:07

之前按照这个方法 成功开启伪静态
昨天晚上从新执行 /root/vhost.sh 命令覆盖了以前的虚拟主机!路径都是跟原来的一样~是不是这个地方出来问题

licess 发表于 2011-6-18 20:21:44

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

yuweitaocn 发表于 2011-6-19 12:23:46

老兄你写错了奥。要写在location location /{}里面的啊,不然他不知道你要请求的是什么的啊。。。晕死了。
页: [1]
查看完整版本: nginx伪静态设置问题劳烦大家帮帮忙