通知短信+运营短信,5秒速达,支持群发助手一键发送🚀高效触达和通知客户 广告
Nginx 简介与安装 --- Nginx是一款自由的、开源的、高性能的HTTP服务器和反向代理服务器;同时也是一个IMAP、POP3、SMTP代理服务器;Nginx可以作为一个HTTP服务器进行网站的发布处理,另外nginx可以作为反向代理进行负载均衡的实现。 Nginx主要用作与 * 反向代理 * 负载均衡 ## Nginx 的安装 #### 1.更新库并安装nginx >`sudo add-apt-repository ppa:nginx/stable` >`sudo apt-get update` >`sudo apt-get install -y nginx` #### 2.验证 nginx 版本号 >`nginx -v` >服务器返回内容 nginx version: nginx/x.x.x.x #### 3.启动 Nginx >`sudo systemctl start nginx` #### 4.查看 Nginx 状态 >`sudo systemctl status nginx` ## Nginx 的反向代理配置 #### 1.前往Nginx配置文件夹目录 >`cd /etc/nginx/sites-available` #### 2.使用nano创建并配置conf >`sudo nano www.example.com (其中www.example.com为你的域名,例www.svlog.com)` #### 3.在创建的新文件中,输入以下内容 >``` > server { > listen 80; > server_name www.example.com; > location / { > proxy_set_header X-Real-IP $remote_addr; > proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; > proxy_set_header X-Forwarded-Proto $scheme; > proxy_set_header Host $http_host; > proxy_set_header X-NginX-Proxy true; > proxy_pass http://127.0.0.1; > proxy_redirect off; > proxy_http_version 1.1; > proxy_set_header Upgrade $http_upgrade; > proxy_set_header Connection "upgrade"; > } >} >``` --- 至此 Nginx 安装配置完毕 当然还有更多的比如SSL啊负载均衡啊,这里就不多做介绍了