# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user root;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
//////負載均衡的關鍵【要在http里面】
upstream group{
server 192.168.0.180:80;
server 192.168.0.181:80;
}
server {
listen 80;
listen [::]:80 default_server;
server_name _;
root /var/www/html;
index index.php
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
proxy_pass http://group;//負衡均衡跳轉group對應upstream 后面的名稱,如果不用負載均衡可用下面兩行屏蔽的直接引到對應目錄
# root /var/www/html;
# index index.php index.html index.htm;
}
location ~ \.php$ {
root /var/www/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
include fastcgi_params;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
# Settings for a TLS enabled server.
#
# server {
# listen 443 ssl http2 default_server;
# listen [::]:443 ssl http2 default_server;
# server_name _;
# root /usr/share/nginx/html;
#
# ssl_certificate "/etc/pki/nginx/server.crt";
# ssl_certificate_key "/etc/pki/nginx/private/server.key";
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 10m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
#
# # Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
#
# location / {
# }
#
# error_page 404 /404.html;
# location = /40x.html {
# }
#
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
# }
}
到此,相信大家對“Nginx負載均衡的配置和使用方法”有了更深的了解,不妨來實際操作一番吧!這里是本站網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
本文由 貴州做網站公司 整理發布,部分圖文來源于互聯網,如有侵權,請聯系我們刪除,謝謝!
c語言中正確的字符常量是用一對單引號將一個字符括起表示合法的字符常量。例如‘a’。數值包括整型、浮點型。整型可用十進制,八進制,十六進制。八進制前面要加0,后面...
2022年天津專場考試原定于3月19日舉行,受疫情影響確定延期,但目前延期后的考試時間推遲。 符合報名條件的考生,須在規定時間登錄招考資訊網(www.zha...
:喜歡聽,樂意看。指很受歡迎?!巴卣官Y料”喜聞樂見:[ xǐ wén lè jiàn ]詳細解釋1. 【解釋】:喜歡聽,樂意看。指很受歡迎。2. 【示例】:這是...
【資料圖】在生活中,很多人都不知道北京的三聯書店在什么地方是什么意思,其實他的意思是非常簡單的,下面就是小編搜索到的北京的三聯書店在什么地方相關的一些知識,我們一起來學習下吧!北京市的三聯書店有:五道口店:位于北京市清華同方科技大廈D座1層。美術館店:位于北京市東城區美術館東街22號。西三環南路店:位于北京市西三環南路1號北京市政務服務中心內一層。亦莊店:位于北京市大興區隆慶街6號77文創園?;佚?..
怎么理解行業景氣度?行業景氣度(也稱企業景氣度),顧名思義,表示某個行業的景氣程度,即行業市場的興盛和繁榮程度。在投資活動中,任何投資者都無法回避對行業景氣度的關注、了解和分析。行業景氣度,很多歐和美國家都有一個量化表達這個抽象概念的指標,我們稱之為行業景氣指數(或企業景氣指數)。商業繁榮調查。通過對大中小企業法人和主要負責人的定期問卷調查,了解企業家對企業生產經營的判斷和預期,然后在這些問卷信息...
“王心凌概念股”市值蒸發千億怎么回事?王心凌概念股其實指的是芒果超媒,由于現在網上都把芒果超媒股票稱之為“王心凌概念股”所以王心凌概念股也因此而誕生了。王心凌概念股誕生之后,原本以為芒果超媒的股票開市后會一路高漲,結果5月23日開盤后,芒果超媒的股價卻是一路下跌。5月23日芒果超媒股價一路下跌,截止當日收盤時間,芒果超媒下跌超1%。根據數據顯示,芒果...