Hi guys,
It’s me again I was trying to install siwapp on my webserver but I
couldn’t make it work with nginx, here is the .htaccess file content:
Options +FollowSymLinks +ExecCGI
AddDefaultCharset utf-8
Order deny,allow
Deny from all
<FilesMatch “pre_.+.php”>
Order deny,allow
Deny from all
RewriteEngine On
uncomment the following line, if you are having trouble
getting no_script_name to work
#RewriteBase /
we skip all files with .something
RewriteCond %{REQUEST_URI} ..+$
RewriteCond %{REQUEST_URI} !.html$
RewriteRule .* - [L]
we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
I’ve tried to convert to:
rewrite ^ index.php last;
But it didn’t work.
When I access http://myurl.com/installer.php nginx could display the
page correctly, but when I clicked Next button, it said: “404 Not Found”
(new URL: http://myurl.com/installer.php/step1)
Anyone has any solution for this?
Thank in advanced,
Giang
Posted at Nginx Forum:
Giang
2
On Fri, Oct 28, 2011 at 10:26 AM, Giang [email protected] wrote:
<FilesMatch “.(lock|conf)$”>
Order deny,allow
Deny from all
location ~ .(lock|conf)$ { deny all; }
<FilesMatch “pre_.+.php”>
Order deny,allow
Deny from all
location ~ pre_.+.php$ { deny all; }
RewriteCond %{REQUEST_URI} !.html$
location ~ /[^.]+$ {
try_files $uri $uri/ $uri.html /index.php;
}
–
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
Giang
3
On Fri, Oct 28, 2011 at 10:26 AM, Giang [email protected] wrote:
When I access http://myurl.com/installer.php nginx could display the
page correctly, but when I clicked Next button, it said: “404 Not Found”
(new URL: http://myurl.com/installer.php/step1)
As for this one, you need something with fastcgi_split_path. I’m not
really familiar but I think something like this:
location ~ .php(/.+)$ {
fastcgi_split_path …
…
}
–
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
Giang
4
Thank you. I’ve changed as you suggested, but it still hasn’t worked.
When I clicked Next button, it just reloaded the page.
Here is my new nginx configuration file content:
location ~ .(lock|conf)$ { deny all; }
location ~ pre_.+.php$ { deny all; }
location ~ /[^.]+$ {
try_files $uri $uri/ $uri.html /index.php;
}
location ~ .php(/.+)$ {
fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME
/var/www/siwapp/web$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
}
Posted at Nginx Forum:
Giang
5
I realize I’m responding to an old thread here, but thought I would post
the configuration that I used to get this working:
location / {
try_files $uri $uri/ /index.php$uri?$args;
}
location = /robots.txt { access_log off; log_not_found off; }
location = /favicon.ico { access_log off; log_not_found off; }
location ~ /. {access_log off; log_not_found off; deny all; }
location ~ .(lock|conf)$ { access_log off; log_not_found off; deny
all; }
location ~ pre_.+.php { access_log off; log_not_found off; deny all;
}
location = /test_rewrite1.txt { rewrite ^ /test_rewrite2.txt; }
location /js/i18n {
autoindex on;
}
location ~ .php {
include fastcgi.conf;
fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass unix:/tmp/php-fpm.sock;
}
Posted at Nginx Forum: