weiseven 发表于 2010-6-2 14:32:21

nginx伪静态设置问题

请各位成功设置nginx伪静态的朋友,指点一下.无论如何设置都不能在网站前台实现.按着帖子上面的方法试过N次了,还没有没有设置好.望走过看过的朋友留意,谢谢!server
        {
                listen       80;
                server_name www.esinomarr.com;
                index index.html index.htm index.php;
                root/home/wwwroot/;
                location ~ .*\.(php|php5)?$
                        {
                                fastcgi_passunix:/tmp/php-cgi.sock;
                                fastcgi_index index.php;
                                include fcgi.conf;
                        }
            
            if (!-e $request_filename) {
      RewriteEngine On
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)\?*$ index.php?_route_=$1
            }
            
                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/wwwroot/logs/access.logaccess;
        }
include vhost/*.conf;
}另外一个方法也行不通server
        {
                listen       80;
                server_name www.esinomarr.com;
                index index.html index.htm index.php;
                root/home/wwwroot/;
                include rewrite.conf;   
                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/wwwroot/logs/access.logaccess;
        }
include vhost/*.conf;
}下面是rewrite.conf代码# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.

# 2. In your opencart directory rename htaccess.txt to .htaccess.

# For any support issues please visit: http://www.opencart.com

Options +FollowSymlinks

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?_route_=$1

[ 本帖最后由 weiseven 于 2010-6-2 16:12 编辑 ]

licess 发表于 2010-6-2 15:36:07

回复 1# 的帖子

你rewrite.conf里面写的是apache的伪静态肯定不能用在nginx上,你上官网看看或搜索一下有没有opencart的nginx伪静态。或者用http://www.anilcetin.com/convert-apache-htaccess-to-nginx/ 转换试试

spectrum 发表于 2010-6-2 16:07:54

为静态一点问题都没有, 参考我的帖子.

qun.baowang.com都已经是伪静态了.

weiseven 发表于 2010-6-2 16:17:01

感谢军哥的指导.已经成功静态!希望可以帮到其他跟我一样的新手.:)

licess 发表于 2010-6-2 19:14:53

回复 4# 的帖子

:handshake

qqab 发表于 2011-4-5 16:39:22

www.23152316.com 伪静态成功
页: [1]
查看完整版本: nginx伪静态设置问题