您好,登錄后才能下訂單哦!
這篇文章主要介紹Linux下怎么配置Nginx反向代理,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
反向代理功能是nginx的三大主要功能之一,反向代理服務(wù)器是一種代理服務(wù)器,用于管理從外部網(wǎng)絡(luò)到內(nèi)部網(wǎng)絡(luò)的連接或任何特定請(qǐng)求。它保護(hù)、路由和管理從外部網(wǎng)絡(luò)到內(nèi)部網(wǎng)絡(luò)、Web服務(wù)器或?qū)S镁W(wǎng)絡(luò)的流量。
Yum update -y Yum remove httpd -y
rpm -Uvh http://mirror.ancl.hawaii.edu/linux/epel/6/i386/epel-release-6-8.noarch.rpm EPEL repo下載地址:https://fedoraproject.org/wiki/EPEL
安裝Nginx
yum install nginx -y 調(diào)整Nginx配置
cd /etc/nginx/conf.d mv default.conf default.conf.disabled
cd /etc/nginx/conf.d vi yourdomain.com
粘貼以下內(nèi)容:
server { listen 80; server_name yourdomain.com; access_log off; error_log off; location / { proxy_pass http://需要反代的服務(wù)器IP/; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_max_temp_file_size 0; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; } }
然后保存。
iptables -I INPUT 5 -m state --state NEW -p tcp --dport 80 -j ACCEPT service iptables save service iptables restart
service nginx start
以上是“Linux下怎么配置Nginx反向代理”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。