Difference between revisions of "Nginx Sample Configurations"

From wikieduonline
Jump to navigation Jump to search
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
Example of the '''simplest''' nginx possible configuration file, listening on default http port: 80.  
 
Example of the '''simplest''' nginx possible configuration file, listening on default http port: 80.  
/etc/nginx/conf.d/[[default.conf]]
+
*<code>/etc/nginx/conf.d/[[default.conf]]</code>
 +
 
 +
Without [[TLS/SSL]]
 
<pre>
 
<pre>
 
server {
 
server {
Line 9: Line 11:
  
  
With SSL
+
With TLS/SSL
<pre>
+
 
server {
+
server {
 
   listen 80 ;
 
   listen 80 ;
 
   listen 443 ssl;
 
   listen 443 ssl;
   server_name yourdomain.com;
+
   server_name YOUR_DOMAIN.COM;
 
+
   [[ssl_certificate]]      /etc/nginx/ssl/example.pem;
+
   ssl_certificate /etc/letsencrypt/live/YOUR_DOMAIN.COM/fullchain.[[pem]];
   [[ssl_certificate_key]]  /etc/nginx/ssl/example.key;
+
   ssl_certificate_key /etc/letsencrypt/live/YOUR_DOMAIN.COM/privkey.pem;
 
+
 
   location / {
 
   location / {
 
     [[proxy_pass]]          http://IP_BACKEN_SERVER:PORT_NUMBER;
 
     [[proxy_pass]]          http://IP_BACKEN_SERVER:PORT_NUMBER;
 
   }
 
   }
}
+
}
</pre>
 
  
  
 
== Related terms ==
 
== Related terms ==
 +
*<code>[[ssl_certificate]] /etc/ssl/certs/ssl-cert-snakeoil.pem;</code>
 +
*<code>ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;</code>
 +
 +
 
* <code>[[nginx.conf]]</code>
 
* <code>[[nginx.conf]]</code>
 
* [[Track Application Response time in Nginx]]
 
* [[Track Application Response time in Nginx]]
 +
* [[docker-compose.yml]]
  
 
== See also ==
 
== See also ==

Latest revision as of 10:02, 27 August 2021

Example of the simplest nginx possible configuration file, listening on default http port: 80.

Without TLS/SSL

server {
    listen 80;
    root /path/to/your/html_files;
}


With TLS/SSL

server {
 listen 80 ;
 listen 443 ssl;
 server_name YOUR_DOMAIN.COM;

 ssl_certificate /etc/letsencrypt/live/YOUR_DOMAIN.COM/fullchain.pem;
 ssl_certificate_key /etc/letsencrypt/live/YOUR_DOMAIN.COM/privkey.pem;

 location / {
   proxy_pass          http://IP_BACKEN_SERVER:PORT_NUMBER;
 }
}


Related terms[edit]

  • ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
  • ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;


See also[edit]

Advertising: