Convert lighttpd rewrite rule to nginx

Igor Sysoev igor at sysoev.ru
Thu Jul 26 04:31:14 UTC 2012


On Wed, Jul 25, 2012 at 08:47:57PM -0400, justin wrote:
> Igor,
> 
> Thanks for the reply. Still not working, getting 404 error.
> 
> Here is the config snippet I am using:
> 
> server {
>   listen 80;
> 
>   server_name app.mydomain.com;
> 
>   root /srv/www/domains/app.mydomain.com;
>   
>   index index.php;
> 
>   access_log /var/log/nginx/domains/app.mydomain.com/access.log;
>   error_log /var/log/nginx/domains/app.mydomain.com/error.log;
> 
>   include /etc/nginx/excludes.conf;
> 
>   location ~ ^[^.]+$ {
>     try_files $uri =404;

As I understand the requested file does not exist on file system,
so try_files cannot find it and returns 404. The try_files is not
needed here.

>     fastcgi_param SCRIPT_FILENAME $document_root/controller.php;
>     fastcgi_param PATH_INFO $uri;
>     fastcgi_intercept_errors on;
>     fastcgi_pass 127.0.0.1:9000;
>     include /etc/nginx/fastcgi_params;
>   }
> 
>   #Needed for standard php files which end with the .php extension
>   include /etc/nginx/php.conf;
> 
>   include /etc/nginx/expires.conf;
> }


-- 
Igor Sysoev



More information about the nginx mailing list