Difference between revisions of "Nginx Sample Configurations"
Jump to navigation
Jump to search
| Line 12: | Line 12: | ||
With TLS/SSL | With TLS/SSL | ||
| − | + | ||
| − | server { | + | server { |
listen 80 ; | listen 80 ; | ||
listen 443 ssl; | listen 443 ssl; | ||
server_name yourdomain.com; | server_name yourdomain.com; | ||
| − | + | ||
[[ssl_certificate]] /etc/nginx/ssl/example.pem; | [[ssl_certificate]] /etc/nginx/ssl/example.pem; | ||
[[ssl_certificate_key]] /etc/nginx/ssl/example.key; | [[ssl_certificate_key]] /etc/nginx/ssl/example.key; | ||
| − | + | ||
location / { | location / { | ||
[[proxy_pass]] http://IP_BACKEN_SERVER:PORT_NUMBER; | [[proxy_pass]] http://IP_BACKEN_SERVER:PORT_NUMBER; | ||
} | } | ||
| − | } | + | } |
| − | |||
Revision as of 05:41, 1 July 2020
Example of the simplest nginx possible configuration file, listening on default http port: 80. /etc/nginx/conf.d/default.conf
Without TLS/SSL
server {
listen 80;
root /path/to/your/html_files;
}
With TLS/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
- Nginx:
nginx -t,nginx.conf,/etc/nginx/fastcgi.conf, Nginx Sample Configurations,server,ssl_certificate,redirect,return,rewrite,sendfile,request_uri,server_name,listen,/etc/nginx/snippets/,/etc/nginx/sites-enabled/default - Web server: Nginx:
/etc/nginx/nginx.conf,nginx -t, Nginx logs, Nginx change log, PHP,php-fpm, Let's encrypt, Nginx directives, Reverse Proxy, Configure HTTP redirection Nginx, Return,proxy_pass (Reverse proxy),ngx_http_rewrite_module,/etc/nginx/sites-enabled/,error.log,access.log,/nginx status, AIO
Advertising: