Welcome! Log In Create A New Profile

Advanced

Re: htaccess для nginx

uri
October 28, 2010 03:13PM
Не буду плодить темы.

есть htaccess:

RewriteRule ^\.htaccess$ - [F]

RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /html/index.php [NC,L]

RewriteCond %{REQUEST_URI} !^/html/.*$
RewriteRule ^(.*)$ /html/$1

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]

RewriteRule ^html/.*$ /html/index.php [NC,L]

Никак не могу переписать на nginx. Пользовался онлайн конвертором (http://www.anilcetin.com/convert-apache-htaccess-to-nginx/) кое-что перевел, работает но выглядит не очень "красиво". Последние два правила не подобрал.


Вот мой конфиг хоста:

server {
listen 80;
server_name somehost.org www.somehost.org;

access_log /var/log/nginx/somehost.org-access_log main;
error_log /var/log/nginx/somehost.org-error.log;

location / {
root /var/www/html/somehost.org;
index index.html index.htm index.php;

### RewriteCond %{REQUEST_URI} ="" RewriteRule ^.*$ /html/index.php [NC,L] ##

if ($uri ~ ''){
set $rule_0 1$rule_0;
}
if ($rule_0 = "1"){
rewrite ^/.*$ /html/index.php last;
}
############################################################################

}

### RewriteCond %{REQUEST_URI} !^/html/.*$ RewriteRule ^(.*)$ /html/$1 #####

if ($uri !~ ^/html/.*$){
set $rule_0 1$rule_0;
}
if ($rule_0 = "1"){
rewrite ^/(.*)$ /html/$1 last;
}
################################################################

### RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^.*$ - [NC,L] #######
???
################################################################

### RewriteRule ^html/.*$ /html/index.php [NC,L] ###########################
???
################################################################
location ~ \.php$ {
root /var/www/html/somehost.org;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/somehost.org$fastcgi_script_name;
include fastcgi_params;
}

location ~ /\.ht {
deny all;
}
}

С регуляркой у меня не очень, спасибо если кто подскажет чего.
Subject Author Posted

htaccess для nginx

Rollex April 20, 2010 03:34PM

Re: htaccess для nginx

Sergey Shepelev April 21, 2010 03:30AM

Re: htaccess для nginx

Rollex April 21, 2010 02:27PM

Re: htaccess для nginx

Rollex April 23, 2010 06:47AM

Re: htaccess для nginx

Rollex April 25, 2010 08:10AM

Re: htaccess для nginx

Alexey V. Karagodov April 25, 2010 02:36PM

Re: htaccess для nginx

Sergey Shepelev April 25, 2010 02:52PM

Re: htaccess для nginx

Rollex April 26, 2010 10:24AM

Re: htaccess для nginx

Sergey Shepelev April 26, 2010 11:06AM

Re: htaccess для nginx

uri October 28, 2010 03:13PM

Re: htaccess для nginx

Богун Дмитрий October 29, 2010 07:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 307
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready