How to disable timeout for nginx?

It may not be possible to disable it at all, yet a feasible workaround is to increase the execution time. On a nginx tutorial site, it was written: If you want to increase time-limit for all-sites on your server, you can edit main nginx.conf file: vim /etc/nginx/nginx.conf Add following in http{..} section http { fastcgi_read_timeout … Read more

How to restart nginx?

The nginx package supplies a /etc/init.d/nginx script that provides the usual start|stop|restart|reload … functionality. /etc/init.d/nginx restart will restart nginx as will service nginx restart Edit Here is a link to a script you can use as /etc/init.d/nginx.

Setting expires headers for static content served from nginx

I prefer to do a more complete cache header, in addition to some more file extensions. The ‘?’ prefix is a ‘non-capturing’ mark, nginx won’t create a $1. It helps to reduce unnecessary load. location ~* \.(?:ico|css|js|gif|jpe?g|png)$ { expires 30d; add_header Pragma public; add_header Cache-Control “public”; }

Nginx 1 FastCGI sent in stderr: “Primary script unknown”

The error message “primary script unknown” is almost always related to a wrongly set SCRIPT_FILENAME in the nginx fastcgi_param directive (or incorrect permissions, see other answers). You’re using an if in the configuration you posted first. Well it should be well known by now that if is evil and often produces problems. Setting the root … Read more

Can I hide all server / os info?

You can stop it outputting the version of Nginx and OS by adding server_tokens off; to a http, server, or location context. Or if you want to remove the Server header completely, you need to compile Nginx with the Headers More module in, as the header is hard coded in the Nginx source, and this … Read more

Is it possible to make Nginx listen to different ports?

Yes, it is. What you probably want is multiple “server” stanzas, each with a different port, but possibly (probably?) the same server_name, serving the “different” content appropriately within each one, maybe with a different document root in each server. Full documentation is here: http://nginx.org/en/docs/http/server_names.html Example: server { listen 80; server_name example.org www.example.org; root /var/www/port80/ } … Read more

connect() failed (111: Connection refused) while connecting to upstream

It sounds like you haven’t started and configured the backend for Nginx. Start php-fpm and add the following to nginx.conf, in the http context: server { listen 127.0.0.1; server_name localhost; error_log /var/log/nginx/localhost.error_log info; root /var/www/localhost/htdocs; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; fastcgi_intercept_errors on; error_page 404 /error/404.php; } }

Make nginx to pass hostname of the upstream when reverseproxying

Actually you can do that via proxy_set_header. For more details look here: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_set_header or see an example use-case here: https://stackoverflow.com/questions/12847771/configure-nginx-with-proxy-pass I have included the dynamic approach into your above posted configuration: server { listen 80; server_name example.com; location / { proxy_pass http://main; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; } } Here is an example with … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)