- 积分
- 6
- 威望
-
- 金钱
-
- 注册时间
- 2011-2-8
- 在线时间
- 小时
- 最后登录
- 1970-1-1
|
1,我的主站.htaccess的规则如下:Options +FollowSymLinks
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_URI} !-d
RewriteRule ^download/(.*)/(.*)$ index.php?id=$1 [QSA,L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_URI} !-d
RewriteRule ^remove/(.*)/(.*)/(.*)$ index.php?id=$2&remove=$1 [QSA,L]
2,我用自动转换规则的那个地址转换:
http://www.anilcetin.com/convert-apache-htaccess-to-nginx/
3,转换后得到:
#ignored: condition 0
if (!-d $uri){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
rewrite ^/download/(.*)/(.*)$ /index.php?id=$1 last;
}
#ignored: condition 0
if (!-d $uri){
set $rule_1 2$rule_1;
}
if ($rule_1 = "21"){
rewrite ^/remove/(.*)/(.*)/(.*)$ /index.php?id=$2&remove=$1 last;
}
4,我把转换后的用WinSCP工具直接连接LINUX直接编辑 /usr/local/nginx/conf/nginx.conf 文件;
server
{
listen 80;
server_name 97sis.info;
index index.html index.htm index.php;
root /home/wwwroot;
location / {
#ignored: condition 0
if (!-d $uri){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
rewrite ^/download/(.*)/(.*)$ /index.php?id=$1 last;
}
#ignored: condition 0
if (!-d $uri){
set $rule_1 2$rule_1;
}
if ($rule_1 = "21"){
rewrite ^/remove/(.*)/(.*)/(.*)$ /index.php?id=$2&remove=$1 last;
}
}
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/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;
................................................................................
5,我按照这个步骤,然后访问网站,网站可以运行,可是伪静态没有起到作用,求问,我的步骤对吗?哪里设置错了?谢谢回答! |
|