nginx負載均衡一些配置的實戰(zhàn)演示!
(1)解壓nginx:
(2)解壓openssl:
(3)解壓pcre:
(4)解壓zlib:
(5)進行配置,先進入到nginx里面去,然后執(zhí)行下面語句:
./configure --prefix=/usr/local/nginx
--with-h(huán)ttp_realip_module
--with-h(huán)ttp_addition_module
--with-h(huán)ttp_gzip_static_module
--with-h(huán)ttp_secure_link_module
--with-h(huán)ttp_stub_status_module
--with-stream
--with-pcre=/home/txp/share/nginx/pcre-8.41
--with-zlib=/home/txp/share/nginx/zlib-1.2.11
--with-openssl=/home/txp/share/nginx/openssl-1.1.0g
然后直接make:
然后接著再sudo make install:
最終我們可以看到在/usr/local/nginx/目錄下看到安裝的nginx:
現(xiàn)在我們可以試著來運行nginx,并進行訪問(下面的訪問成功):
這里小結(jié)一下:
很多開源軟件的安裝步驟大概都差不多是下面這樣的套路(比如等下我們下面要安裝的模塊,也是這樣安裝的思路,所以這里就不造輪子了)
-- ./cofigure
-- make
--sudo make install
2、自己寫conf文件
在平時的開發(fā)過程中,主要我們要去配置它的conf文件夾下的nginx.conf文件
root@ubuntu:/usr/local/nginx# ls
client_body_temp conf fastcgi_temp
html logs proxy_temp sbin scgi_temp
uwsgi_temp
這個文件原本內(nèi)容是:
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.a(chǎn)ccess.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html

請輸入評論內(nèi)容...
請輸入評論/評論長度6~500個字
最新活動更多
推薦專題
- 1 AI 眼鏡讓百萬 APP「集體失業(yè)」?
- 2 大廠紛紛入局,百度、阿里、字節(jié)搶奪Agent話語權(quán)
- 3 深度報告|中國AI產(chǎn)業(yè)正在崛起成全球力量,市場潛力和關(guān)鍵挑戰(zhàn)有哪些?
- 4 上海跑出80億超級獨角獸:獲上市公司戰(zhàn)投,干人形機器人
- 5 國家數(shù)據(jù)局局長劉烈宏調(diào)研格創(chuàng)東智
- 6 下一代入口之戰(zhàn):大廠為何紛紛押注智能體?
- 7 百億AI芯片訂單,瘋狂傾銷中東?
- 8 Robotaxi新消息密集釋放,量產(chǎn)元年誰在領(lǐng)跑?
- 9 格斗大賽出圈!人形機器人致命短板曝光:頭腦過于簡單
- 10 “搶灘”家用機器人領(lǐng)域,聯(lián)通、海爾、美的等紛紛入局