nginx- duplicate default server error

You likely have other files (such as the default configuration) located in /etc/nginx/sites-enabled that needs to be removed. This issue is caused by a repeat of the default_server parameter supplied to one or more listen directives in your files. You’ll likely find this conflicting directive reads something similar to: listen 80 default_server; As the nginx … Read more

Nginx Different Domains on Same IP

Your “listen” directives are wrong. See this page: http://nginx.org/en/docs/http/server_names.html. They should be server { listen 80; server_name www.domain1.example; root /var/www/domain1; } server { listen 80; server_name www.domain2.example; root /var/www/domain2; } Note, I have only included the relevant lines. Everything else looked okay but I just deleted it for clarity. To test it you might want … Read more

Why does Unicorn need to be deployed together with Nginx?

Nginx is a pure web server that’s intended for serving up static content and/or redirecting the request to another socket to handle the request. Unicorn is a Rack web server and only intended to host a ‘Rack App’ which is usually generating dynamic content. Rack apps can also serve up static content but it’s less … Read more

Dealing with nginx 400 “The plain HTTP request was sent to HTTPS port” error

I ran into a similar problem. It works on one server and does not on another server with same Nginx configuration. Found the the solution which is answered by Igor here http://forum.nginx.org/read.php?2,1612,1627#msg-1627 Yes. Or you may combine SSL/non-SSL servers in one server: server { listen 80; listen 443 default ssl; # ssl on – remember … Read more

How to redirect a URL in Nginx

Best way to do what you want is to add another server block: server { #implemented by default, change if you need different ip or port #listen *:80 | *:8000; server_name test.com; return 301 $scheme://www.test.com$request_uri; } And edit your main server block server_name variable as following: server_name www.test.com; Important: New server block is the right … Read more

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