设为首页
收藏本站
切换到宽版
用户名
Email
自动登录
找回密码
密码
登录
注册
快捷导航
论坛
BBS
排行榜
Ranklist
搜索
搜索
热搜:
香港vps
香港VPS
amh
机柜
vps
分销
VPS
域名出售
火车头
云主机
不限流量
香港服务器
美国服务器
香港
全能空间
whmcs
digitalocean
本版
帖子
用户
MJJ论坛
»
论坛
›
主机综合交流
›
美国VPS综合讨论
›
求教一下啊nginx下dz的伪静态设置 老是404 想死的心都有 ...
1
2
/ 2 页
下一页
返回列表
查看:
5954
|
回复:
17
[疑问]
求教一下啊nginx下dz的伪静态设置 老是404 想死的心都有了
[复制链接]
tcy713
tcy713
当前离线
积分
112
发表于 2009-12-30 18:10:30
|
显示全部楼层
|
阅读模式
求教一下啊nginx下dz的伪静态设置 老是404 想死的心都有了
本人菜鸟啊 配置代码如下 BBS目录是 home/wwwroot/bbs
请大虾们帮忙啊
server
{
listen 80;
server_name
www.yykafei.com
;
index index.html index.htm index.php;
root /home/wwwroot;
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
location / {
index index.html index.htm index.php;
root /home/wwwroot/bbs;
rewrite ^/archiver/((fid|tid)-[\w\-]+\.html)$ /archiver/index.php?$1 last;
rewrite ^/forum-([0-9]+)-([0-9]+)\.html$ /forumdisplay.php?fid=$1&page=$2 last;
rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /viewthread.php?tid=$1&extra=page\%3D$3&page=$2 last;
rewrite ^/space-(username|uid)-(.+)\.html$ /space.php?$1=$2 last;
rewrite ^/tag-(.+)\.html$ /tag.php?name=$1 last;
break;
}
回复
举报
God
God
当前离线
积分
202
发表于 2009-12-30 18:17:59
|
显示全部楼层
rewrite ^/bbs/archiver/((fid|tid)-[\w\-]+\.html)$ /bbs/archiver/index.php?$1 last;
rewrite ^/bbs/forum-([0-9]+)-([0-9]+)\.html$ /bbs/forumdisplay.php?fid=$1&page=$2 last;
rewrite ^/bbs/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /bbs /viewthread.php?tid=$1&extra=page\%3D$3&page=$2 last;
rewrite ^/bbs/space-(username|uid)-(.+)\.html$ /bbs /space.php?$1=$2 last;
rewrite ^/bbs/tag-(.+)\.html$ /bbs/tag.php?name=$1 last;
回复
支持
反对
举报
cpuer
cpuer
当前离线
积分
85740
发表于 2009-12-30 18:31:52
|
显示全部楼层
回复 1# 的帖子
location /bbs/
这个子目录内则。
回复
支持
反对
举报
霸武邪皇
霸武邪皇
当前离线
积分
2197
发表于 2009-12-30 18:34:38
|
显示全部楼层
还是老大的技术牛啊
回复
支持
反对
举报
tcy713
tcy713
当前离线
积分
112
楼主
|
发表于 2009-12-30 18:50:40
|
显示全部楼层
回复 3# 的帖子
是这样吗?还是不行啊
location /bbs/ {
index index.html index.htm index.php;
root /home/wwwroot/bbs;
rewrite ^/bbs/archiver/((fid|tid)-[\w\-]+\.html)$ /bbs/archiver/index.php?$1 last;
rewrite ^/bbs/forum-([0-9]+)-([0-9]+)\.html$ /bbs/forumdisplay.php?fid=$1&page=$2 last;
rewrite ^/bbs/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /bbs /viewthread.php?tid=$1&extra=page\%3D$3&page=$2 last;
rewrite ^/bbs/space-(username|uid)-(.+)\.html$ /bbs /space.php?$1=$2 last;
rewrite ^/bbs/tag-(.+)\.html$ /bbs/tag.php?name=$1 last;
break;
}
回复
支持
反对
举报
cpuer
cpuer
当前离线
积分
85740
发表于 2009-12-30 19:41:33
|
显示全部楼层
回复 1# 的帖子
把
location / bbs/ {
rewrite ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2 last;
rewrite ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3 last;
rewrite ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^(.*)/profile-(username|uid)-(.+)\.html$ $1/viewpro.php?$2=$3 last;
rewrite ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3 last;
rewrite ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2 last;
}
放到
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
之前,然后测试下nginx -t 语法是否有错。
回复
支持
反对
举报
tcy713
tcy713
当前离线
积分
112
楼主
|
发表于 2009-12-30 20:10:44
|
显示全部楼层
回复 6# 的帖子
c大啊 还是不行啊 nginx也重启了 问问nginx -t这个命令怎么用的啊 更目录下直接输没用 小白了
server
{
listen 80;
server_name
www.yykafei.com
;
index index.html index.htm index.php;
root /home/wwwroot;
location / bbs/ {
rewrite ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2 last;
rewrite ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3 last;
rewrite ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^(.*)/profile-(username|uid)-(.+)\.html$ $1/viewpro.php?$2=$3 last;
rewrite ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3 last;
rewrite ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2 last;
}
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
location /status {
stub_status on;
access_log off;
}
回复
支持
反对
举报
cpuer
cpuer
当前离线
积分
85740
发表于 2009-12-30 20:24:20
|
显示全部楼层
回复 7# 的帖子
location /status {
stub_status on;
access_log off;
}
这段请删除,你的这个server段放stub_status on; 可不行。
nginx配置文件语法测试命令 /usr/local/nginx/sbin/nginx -t
回复
支持
反对
举报
usa
usa
当前离线
积分
18253
发表于 2009-12-30 20:30:04
|
显示全部楼层
汗~~~
回复
支持
反对
举报
tcy713
tcy713
当前离线
积分
112
楼主
|
发表于 2009-12-30 20:41:11
|
显示全部楼层
回复 8# 的帖子
发个完整的C大帮忙看一下吧 心都碎了
有空了要加强学习啦
[root@** ~]# /usr/local/nginx/sbin/nginx -t
[emerg]: invalid location modifier "/" in /usr/local/nginx/conf/nginx.conf:62
configuration file /usr/local/nginx/conf/nginx.conf test failed
user www www;
worker_processes 1;
error_log /home/wwwroot/logs/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.
worker_rlimit_nofile 51200;
events
{
use epoll;
worker_connections 51200;
}
http
{
include mime.types;
default_type application/octet-stream;
#charse gb2312;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
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_length 1k;
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_zone crawler $binary_remote_addr 10m;
server
{
listen 80;
server_name www.yykafei.com;
index index.html index.htm index.php;
root /home/wwwroot;
location / bbs/ {
rewrite ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2 last;
rewrite ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3 last;
rewrite ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^(.*)/profile-(username|uid)-(.+)\.html$ $1/viewpro.php?$2=$3 last;
rewrite ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3 last;
rewrite ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2 last;
}
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
log_format access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /home/wwwroot/logs/access.log access;
}
include vhost/*.conf;
}
复制代码
回复
支持
反对
举报
下一页 »
1
2
/ 2 页
下一页
返回列表
高级模式
B
Color
Image
Link
Quote
Code
Smilies
您需要登录后才可以回帖
登录
|
注册
本版积分规则
发表回复
回帖后跳转到最后一页
Archiver
|
手机版
|
小黑屋
|
MJJ论坛
Copyright
MJJ论坛
© 2022 All Rights Reserved.
快速回复
返回顶部
返回列表