Difference between revisions of "Nginx Sample Configurations"

From wikieduonline
Jump to navigation Jump to search
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.  
<pre>/etc/nginx/conf.d/default.conf
+
/etc/nginx/conf.d/[[default.conf]]
 +
<pre>
 
server {
 
server {
 
     listen 80;
 
     listen 80;
 
     root /path/to/your/html_files;
 
     root /path/to/your/html_files;
 +
}
 +
</pre>
 +
 +
 +
With SSL
 +
<pre>
 +
server {
 +
  listen 80 ;
 +
  listen 443 ssl;
 +
  server_name yourdomain.com;
 +
 +
  [[ssl_certificate]]      /etc/nginx/ssl/example.pem;
 +
  [[ssl_certificate_key]]  /etc/nginx/ssl/example.key;
 +
 +
  location / {
 +
    [[proxy_pass]]          http://IP_BACKEN_SERVER:PORT_NUMBER;
 +
  }
 
}
 
}
 
</pre>
 
</pre>

Revision as of 05:40, 1 July 2020

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

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


With SSL

server {
  listen 80 ;
  listen 443 ssl;
  server_name yourdomain.com;

  [[ssl_certificate]]      /etc/nginx/ssl/example.pem;
  [[ssl_certificate_key]]  /etc/nginx/ssl/example.key;

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


Related terms

See also

Advertising: