【发布时间】:2012-03-05 01:48:28
【问题描述】:
我正在尝试转换一个 .htaccess 文件,以便它可以在我的 Nginx 服务器上运行。
我有两个主要问题:
1。我不确定如何转换某些行
2。 Nginx的配置代码不知道放哪里
以下是我在转换时遇到问题的行:
Options All -Indexes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?page_request=$1 [QSA,L]
我尝试了一些在线转换器,但它们似乎不起作用。
另外,一旦我转换了线条,我应该把它们放在哪里?我假设我需要将它们放在/etc/nginx/sites-available/ 的mysite.conf 文件中,但是在该文件中,我是否只是将它们放在server {} 块中?
非常感谢您能给我的任何帮助。
编辑:这是 conf 文件
server {
listen 0.0.0.0:80;
server_name www.subdomain.domain.tld subdomain.domain.tld;
access_log /var/log/subdomain.domain.tld.log;
location / {
root /srv/www/subdomain.domain.tld/public_html;
index index.html index.php;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/subdomain.domain.tld/public_html$fastcgi_script_name;
}
try_files $uri $uri/ /index.php?page_request=$uri;
}
【问题讨论】: