Ubuntu nginx 配置例項
阿新 • • 發佈:2021-02-19
技術標籤:nginx
sudo apt-get install nginx
cd /etc/nginx/sites-enabled
upstream rec_proxy { server 110.219.1.9:8087; } server { listen 80; server_name long.com; #client_body_buffer_size 20M; #client_max_body_size 100M; #keepalive_requests 10000; location / { proxy_pass http://rec_proxy; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #proxy_redirect off; proxy_ignore_client_abort on; #proxy_http_version 1.1; #proxy_set_header Connection ""; } error_log /var/log/nginx/error-rec-proxy.log; access_log /var/log/nginx/access-rec-proxy.log; }
- 如果要在更改配置後重新整理Nginx,最好最好重新載入服務。這將關閉舊程序,並使用新配置重新啟動新程序。
使用systemctlLinux命令重新載入Nginx服務。執行以下命令:
sudo systemctl reload nginx