VPS侦探论坛

 找回密码
 注册
查看: 5515|回复: 6

伪静态头疼死我了

[复制链接]
发表于 2014-6-6 15:44:58 | 显示全部楼层 |阅读模式

虚拟主机的配置文件
server

{

listen 80;

#listen [::]:80;

server_name new.ewdai.com;

root /home/www/ewdai.com;

index index.html index.htm index.php default.html default.htm default.php;

#error_page   404   /404.html;

include my.conf;

location ~ [^/]\.php(/|$)

{

# comment try_files $uri =404; to enable pathinfo

try_files $uri =404;

fastcgi_pass  unix:/tmp/php-cgi.sock;

fastcgi_index index.php;

include fastcgi.conf;

#include pathinfo.conf;

}



location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

{

expires      30d;

}



location ~ .*\.(js|css)?$

{

expires      12h;

}



access_log off;

}
自定义的重写规则文件my.conf
location / {



rewrite
^(.*)/user/(.*)/(.*)/(.*)/(.*)$ $1/index\.php?user&user_id=$2&q=code/$3/$4&a=$5 last;

rewrite
^(.*)/user/(.*)/(.*)/(.*)$ $1/index\.php?user&user_id=$2&q=code/$3/$4 last;

rewrite
^(.*)/user/(.*)/(.*)$ $1/index\.php?user&user_id=$2&q=code/$3 last;

rewrite
^(.*)/user/(.*)$ $1/index\.php?user&user_id=$2 last;

rewrite
^(.*)/u/(.*)/(.*)$ $1/index\.php?home&user_id=$2&q=$3 last;

rewrite
^(.*)/u/(.*)$ $1/index\.php?home&user_id=$2 last;

rewrite
^(.*)/(.*)/(.*)/index.html$ $1/index\.php?$2&nid=$3 last;

rewrite
^(.*)/(.*)/(.*)/index(.*).html$ $1/index\.php?$2&nid=$3&page=$4 last;

rewrite
^(.*)/(.*)/(.*)/a(.*).html$ $1/index\.php?$2&nid=$3&article_id=$4 last;

rewrite
^(.*)/(.*)/index.html$ $1/index\.php?$2 last;

rewrite
^(.*)/(.*)/index(.*).html$ $1/index\.php?$2&page=$3 last;

rewrite
^(.*)/(.*)/a(.*)_(.*).html$ $1/index\.php?$2&article_id=$3&page=$4 last;

rewrite
^(.*)/(.*)/a(.*).html$ $1/index\.php?$2&article_id=$3 last;



}

为什么不生效~但是确实加载了这个文件,因为这个文件有错误,nginx会重启失败~求助啊~~~~~~~~~
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2014-6-6 16:31:11 | 显示全部楼层


这个网站急着上线,如果这个伪静态过不去的话,我只能考虑把ngnix换成apache了,我用的的是lnmp1.1,请问军歌,如果要换成apache,需要怎么操作,我是个linux菜鸟,还请尽量详细点~感激不尽。。
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2014-6-6 17:07:55 | 显示全部楼层

location ~ [^/]\.php(/|$) 换成location ~ .*\.(php|php5)?$试试
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2014-6-6 17:13:28 | 显示全部楼层



原帖由 licess 于 2014-6-6 17:07 发表
location ~ [^/]\.php(/|$) 换成location ~ .*\.(php|php5)?$试试
不管用~
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2014-6-6 17:34:23 | 显示全部楼层

伪静态是官网提供的还是程序转换出来的?

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

 楼主| 发表于 2014-6-6 21:40:52 | 显示全部楼层

程序开发公司给的~~~~~~~
发表于 2014-6-7 16:54:25 | 显示全部楼层

可能伪静态有问题
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-25 19:17 , Processed in 0.027317 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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