This object is in archive! 

nginx configuration

Archived Erik L. 12 years ago

I get alot of 404 not found running useresponse on nginx / php5-fpm.

Best Answer
photo

Erik,

On nginx you need your own configuration file instead of .htaccess which is used for apache.

You can convert apache htaccess located in root to nginx configuration using this tool.

Also, check converted instructions manually after conversion and let us know the result

Replies (9)

photo
1

Could you please send us test ftp access for us to the check on the issue with nginx, as mostly customers use apache as set in requirements. Send it to support(at)useresponse.com

photo
1

Currently running in a virtualbox (oracle). But heres the nginx.conf:


server { listen 80; server_name useresponse; access_log /home/web/public_html/useresponse/log/access.log; error_log /home/web/public_html/useresponse/log/error.log; location / { root /home/web/public_html/useresponse/public/; index index.php; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php$ { fastcgi_pass php5-fpm-sock; fastcgi_index index.php; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME /home/web/public_html/useresponse/public/$fastcgi_script_name; } }

photo
1

Erik,

On nginx you need your own configuration file instead of .htaccess which is used for apache.

You can convert apache htaccess located in root to nginx configuration using this tool.

Also, check converted instructions manually after conversion and let us know the result

photo
1

Ok, I have played around now with the nginx conf file and this is my working settings:


server { listen 80; server_name useresponse; root /home/web/useresponse/public; access_log /home/web/useresponse/log/access.log; error_log /home/web/useresponse/log/error.log; location / { index index.php; try_files $uri $uri/ /index.php?$args; } # api requests. rewrite ^/api /api.php; # Directives to send expires headers and turn off 404 error logging. location ~* \.(js|css|png|jpg|jpeg|gif)$ { expires 24h; log_not_found off; add_header Pragma public; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; } ## If no favicon exists return a 204 (no content error). location = /favicon.ico { try_files $uri =204; expires 24h; log_not_found off; access_log off; } ## Don't log robots.txt requests. location = /robots.txt { allow all; log_not_found off; access_log off; } ## this prevents hidden files (beginning with a period) from being served location ~ /\. { access_log off; log_not_found off; deny all; } location ~ \.php$ { client_max_body_size 2M; try_files $uri =404; add_header X-phpcache miss; fastcgi_pass php5-fpm-sock; fastcgi_index index.php; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; }}

photo
1

Erik,

We don't have a chance to check nginx configuration this week. Maybe we'll check on that sometimes next week. As paid customers are more priority for us in providing support.

We'll get back to you when we check on that

photo
1

So this was a problem with UseResponse a year ago? And I am getting the same problem now (404 errors running nginx and php5-fpm). This is not exactly a strange setup that no one uses. Stas, I cannot say I am very impressed here.


I am trying to champion your product for my client and first I have to deal with old mysql passwords and pdo using the newer format, and now everything I click from the home page gives me a 404, including logging in.


When I run the .htaccess file through that converter you linked to, it outputs this:


charset utf-8;

autoindex off;

location / {

if (-e $request_filename){

rewrite ^/api /api.php break;

}

rewrite ^(.*)$ /index.php break;

}


I will deal with this tomorrow. Going to bed frustrated.

photo
1

We decided to switch the server to Apache. Of course we don't have all the needed modules installed. But I think the path of least resistance for UseResponse is running it under Apache. Which is kind of a shame, I like nginx.

photo
1

Denis Hlukhau wrote:

Ken,


Could you specify what version of nginx server do you have so we could send you our working configuration? Also you can take a look on the page where you can see special information connected to installation on nginx.

We are running nginx 1.2.3. Since that was not working, we switched to Apache on that machine, but of course we are missing a whole slew of modules for it now. It would be really ideal to run nginx.

photo
1

Hi Denis,


Wanted to tell you the good news. Got it running under nginx tonight. Getting one error message though, and don't think this is the appropriate thread for it.

Replies have been locked on this page!