Nginx basic usage and HTTPS configuration

Source: Internet
Author: User
Tags letsencrypt

Nginx function Explanation:
1. Reverse proxy: Requires multiple programs to share the 80 port when the use of reverse proxy, Nginx is a reverse proxy implementation.
2. Static resource management: generally use Nginx to do reverse proxy, static resources should be put to nginx management.
3. Load balancing: slightly.

Nginx principle:
Nginx essentially creates a server that listens on port 80 through a configuration file and then redirects the request to the specified port via that server.

Nginx for HTTPS access:
The principle is the same as above, use the configuration file to create an HTTPS server, and then redirect the request through that server to the specified port.


Why use Nginx to manage static resources?
1. Reduced redirection time
2.nginx provides high-performance, static resource management


To install Nginx on Ubuntu:
Reference official website: https://www.nginx.com/resources/wiki/start/topics/tutorials/install/

Start Nginx:/usr/sbin/nginx
Restart Nginx:/usr/sbin/nginx-s Reload
Quit Nginx:/usr/sbin/nginx-s quit

Add a Nginx configuration, you can imitate/etc/nginx/conf.d/veily.conf, add a server.
Example:
server {
Listen 80;
server_name xcx.veilytech.com;
Rewrite ^/(. *) $ https://xcx.xxxx.com:443/$1 permanent;
}

server {
Listen 443 SSL;
SSL_CERTIFICATE/ETC/LETSENCRYPT/LIVE/XCX.XXXX.COM/FULLCHAIN.PEM;
SSL_CERTIFICATE_KEY/ETC/LETSENCRYPT/LIVE/XCX.XXXX.COM/PRIVKEY.PEM;
Keepalive_timeout 70;
server_name xcx.xxxx.com;
#禁止在header中出现服务器版本 to prevent hackers from exploiting version exploits
Server_tokens off;
# ......
Fastcgi_param HTTPS on;
Fastcgi_param Http_scheme HTTPS;
Location/{
Proxy_pass http://127.0.0.1:8093/;
}
}


Nginx basic usage and HTTPS configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.