Redirects all traffic coming to example.com to localhost:5555. Also redirects all http to https. Below is the nginx conf file.
server {
listen 80;
listen 443 ssl;
server_name example.com;
ssl_certificate /etc/ssl/ssl.crt;
ssl_certificate_key /etc/ssl/ssl.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://localhost:5555;
}
if ($ssl_protocol = "") {
return 301 https://example.com$request_uri;
}
}
If SSL is not required, the conf is even simpler, given below. Remove server_name if its the default server.
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://localhost:5555;
}
}
Redirects all traffic coming to
example.comtolocalhost:5555. Also redirects all http to https. Below is the nginx conf file.If SSL is not required, the conf is even simpler, given below. Remove
server_nameif its the default server.