全球主机交流论坛
标题:
崩溃了,ubuntu + nginx + discuz 7.2 URL静态化 出错
[打印本页]
作者:
reed
时间:
2010-10-25 15:26
标题:
崩溃了,ubuntu + nginx + discuz 7.2 URL静态化 出错
每回只要一开启 URL静态化 ,论坛就不能正常访问。
网上有不少说伪静态的问题,都搞了几天了。
主要是不知道正确的是什么样的,现在搞得自己团团转,但使不上劲。
请朋友们指点一二,多谢。
这个坛子上找着以前的贴,感觉跟自己的需求满接近的:
Nginx 在 Discuz 下的 Rewrite 偽靜態配置
http://fd.vvwvv.eu.org/viewthrea ... mp;highlight=discuz
官方帮助文档:
Discuz! 7.0.0 URL 静态化的使用
http://faq.comsenz.com/viewnews-790
我的机器是独立主机,装的 ubuntu10.4+ nginx 0.7.65 + Didcuz 7.2
# /usr/sbin/nginx -V
nginx version: nginx/0.7.65
TLS SNI support enabled
configure arguments: --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug --with-http_stub_status_module --with-http_flv_module --with-http_ssl_module --with-http_dav_module --with-http_gzip_static_module --with-http_realip_module --with-mail --with-mail_ssl_module --with-ipv6 --add-module=/build/buildd/nginx-0.7.65/modules/nginx-upstream-fair
系统上面的目录:
/data/web/www 是帝国下载系统。
/data/web/www/bbs 是Discuz 7.2 .
这是我的niginx.conf:
user www-data;
worker_processes 2;
error_log /dev/null crit;
pid /var/run/nginx.pid;
events {
worker_connections 3000;
}
http {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 8k;
gzip_http_version 1.1;
gzip_comp_level 3;
gzip_types text/css text/xml text/plain application/x-javascript application/xml application/pdf application/x-perl application/x-tcl application/msword application/rtf application/vnd.ms-excel application/vnd.ms-powerpoint application/vnd.wap.xhtml+xml image/x-ms-bmp;
gzip_disable "MSIE [1-6] \.";
gzip_vary on;
output_buffers 4 32k;
client_max_body_size 20m;
server {
listen 80;
server_name localhost;
charset utf-8,gb2312;
access_log /data/web/log/access.log;
server_name_in_redirect off;
location / {
root /data/web/www;
index index.html index.htm index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
set $path_info "/";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css|ico)$ {
root /data/web/www;
access_log off;
expires 30d;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /data/web/www;
}
fastcgi_param SCRIPT_FILENAME /data/web/www/$real_script_name;
fastcgi_param path_info $path_info;
include /etc/nginx/fastcgi_params;
}
}
复制代码
作者:
reed
时间:
2010-10-25 15:28
php、mysql等的配置是按这个贴走的:
ubuntu server 10.04+nginx+mysql+php+eaccelerator[2010/10/06]
http://forum.ubuntu.org.cn/viewtopic.php?t=241301
这个配置是否应该这样写呢?
user www-data;
worker_processes 2;
error_log /dev/null crit;
pid /var/run/nginx.pid;
events {
worker_connections 3000;
}
http {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 8k;
gzip_http_version 1.1;
gzip_comp_level 3;
gzip_types text/css text/xml text/plain application/x-javascript application/xml application/pdf application/x-perl application/x-tcl application/msword application/rtf application/vnd.ms-excel application/vnd.ms-powerpoint application/vnd.wap.xhtml+xml image/x-ms-bmp;
gzip_disable "MSIE [1-6] \.";
gzip_vary on;
output_buffers 4 32k;
client_max_body_size 20m;
server {
listen 80;
server_name localhost;
charset utf-8,gb2312;
access_log /data/web/log/access.log;
server_name_in_redirect off;
location / {
root /data/web/www;
index index.html index.htm index.php;
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;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
set $path_info "/";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css|ico)$ {
root /data/web/www;
access_log off;
expires 30d;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /data/web/www;
}
fastcgi_param SCRIPT_FILENAME /data/web/www/$real_script_name;
fastcgi_param path_info $path_info;
include /etc/nginx/fastcgi_params;
}
}
复制代码
作者:
pigicoffee
时间:
2010-10-25 15:40
location / {
root /data/web/www;
index index.html index.htm index.php;
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;
}
这个重定向是不是位置错了?
作者:
edmin
时间:
2010-10-25 15:41
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;
目录问题吧,斜杠前面都加/bbs 试试
欢迎光临 全球主机交流论坛 (https://fd.vvwvv.eu.org/)
Powered by Discuz! X3.4