ecshop在lnmp下的伪静态问题
ecshop搬家了,以前服务器是apache,现在是nginx搬家之后问题来了,.htaccess不生效,网上查了一下说nginx不支持apache的重写规则,
结合网站的例子找了好久按照网上的步骤:在/usr/local/nginx/conf路径下建立了文件ecshop.conf
内容如下:
if (!-e $request_filename)
{
rewrite "^/index\.html" /index.php last;
rewrite "^/category$" /index.php last;
rewrite "^/feed-c(+)\.xml$" /feed.php?cat=\$1 last;
rewrite "^/feed-b(+)\.xml$" /feed.php?brand=\$1 last;
rewrite "^/feed\.xml$" /feed.php last;
rewrite "^/category-(+)-b(+)-min(+)-max(+)-attr([^-]*)-(+)-(.+)-(+)(.*)\.html$" /category.php?id=\$1&brand=\$2&price_min=\$3&price_max=\$4&filter_attr=\$5&page=\$6&sort=\$7&order=\$8 last;
rewrite "^/category-(+)-b(+)-min(+)-max(+)-attr([^-]*)(.*)\.html$" /category.php?id=\$1&brand=\$2&price_min=\$3&price_max=\$4&filter_attr=\$5 last;
rewrite "^/category-(+)-b(+)-(+)-(.+)-(+)(.*)\.html$" /category.php?id=\$1&brand=\$2&page=\$3&sort=\$4&order=\$5 last;
rewrite "^/category-(+)-b(+)-(+)(.*)\.html$" /category.php?id=\$1&brand=\$2&page=\$3 last;
rewrite "^/category-(+)-b(+)(.*)\.html$" /category.php?id=\$1&brand=\$2 last;
rewrite "^/category-(+)(.*)\.html$" /category.php?id=\$1 last;
rewrite "^/goods-(+)(.*)\.html" /goods.php?id=\$1 last;
rewrite "^/article_cat-(+)-(+)-(.+)-(+)(.*)\.html$" /article_cat.php?id=\$1&page=\$2&sort=\$3&order=\$4 last;
rewrite "^/article_cat-(+)-(+)(.*)\.html$" /article_cat.php?id=\$1&page=\$2 last;
rewrite "^/article_cat-(+)(.*)\.html$" /article_cat.php?id=\$1 last;
rewrite "^/article-(+)(.*)\.html$" /article.php?id=\$1 last;
rewrite "^/brand-(+)-c(+)-(+)-(.+)-(+)\.html" /brand.php?id=\$1&cat=\$2&page=\$3&sort=\$4&order=\$5 last;
rewrite "^/brand-(+)-c(+)-(+)(.*)\.html" /brand.php?id=\$1&cat=\$2&page=\$3 last;
rewrite "^/brand-(+)-c(+)(.*)\.html" /brand.php?id=\$1&cat=\$2 last;
rewrite "^/brand-(+)(.*)\.html" /brand.php?id=\$1 last;
rewrite "^/tag-(.*)\.html" /search.php?keywords=\$1 last;
rewrite "^/snatch-(+)\.html$" /snatch.php?id=\$1 last;
rewrite "^/group_buy-(+)\.html$" /group_buy.php?act=view&id=\$1 last;
rewrite "^/auction-(+)\.html$" /auction.php?act=view&id=\$1 last;
rewrite "^/exchange-id(+)(.*)\.html$" /exchange.php?id=\$1&act=view last;
rewrite "^/exchange-(+)-min(+)-max(+)-(+)-(.+)-(+)(.*)\.html$" /exchange.php?cat_id=\$1&integral_min=\$2&integral_max=\$3&page=\$4&sort=\$5&order=\$6 last;
rewrite ^/exchange-(+)-(+)-(.+)-(+)(.*)\.html$" /exchange.php?cat_id=\$1&page=\$2&sort=\$3&order=\$4 last;
rewrite "^/exchange-(+)-(+)(.*)\.html$" /exchange.php?cat_id=\$1&page=\$2 last;
rewrite "^/exchange-(+)(.*)\.html$" /exchange.php?cat_id=\$1 last;
}然后运行:/root/vhost.sh添加域名
到选择rewrite那一步的时候,填写ecshop.conf,顺利完成域名添加
成功后的域名配置文件/usr/local/nginx/conf/vhost/xxx.com.conf
代码如下:server
{
listen 80;
server_name xxx.com www.xxx.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/www.xxx.com;
include eshop.conf;
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log off;
}点开内页的时候自动跳转到首页了,不知道什么问题,是方法搞错了吗,还是什么问题,期待解答。
[ 本帖最后由 vipmz 于 2011-5-6 12:20 编辑 ]
回复 1# 的帖子
配置文件里是include eshop.conf;你创建的是ecshop.conf
?
再就是最好上ecshop官网上找nginx伪静态试试。
页:
[1]