nginx負(fù)載均衡一些配置的實(shí)戰(zhàn)演示!
(1)解壓nginx:
(2)解壓openssl:
(3)解壓pcre:
(4)解壓zlib:
(5)進(jìn)行配置,先進(jìn)入到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)在我們可以試著來運(yùn)行nginx,并進(jìn)行訪問(下面的訪問成功):
這里小結(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

發(fā)表評論
請輸入評論內(nèi)容...
請輸入評論/評論長度6~500個字
最新活動更多
-
即日-9.16點(diǎn)擊進(jìn)入 >> 【限時福利】TE 2025國際物聯(lián)網(wǎng)展·深圳站
-
10月23日火熱報(bào)名中>> 2025是德科技創(chuàng)新技術(shù)峰會
-
10月23日立即報(bào)名>> Works With 開發(fā)者大會深圳站
-
10月24日立即參評>> 【評選】維科杯·OFweek 2025(第十屆)物聯(lián)網(wǎng)行業(yè)年度評選
-
11月27日立即報(bào)名>> 【工程師系列】汽車電子技術(shù)在線大會
-
12月18日立即報(bào)名>> 【線下會議】OFweek 2025(第十屆)物聯(lián)網(wǎng)產(chǎn)業(yè)大會
推薦專題
- 1 先進(jìn)算力新選擇 | 2025華為算力場景發(fā)布會暨北京xPN伙伴大會成功舉辦
- 2 人形機(jī)器人,正狂奔在批量交付的曠野
- 3 宇樹機(jī)器人撞人事件的深度剖析:六維力傳感器如何成為人機(jī)安全的關(guān)鍵屏障
- 4 解碼特斯拉新AI芯片戰(zhàn)略 :從Dojo到AI5和AI6推理引擎
- 5 AI版“四萬億刺激”計(jì)劃來了
- 6 2025年8月人工智能投融資觀察
- 7 騰訊 Q2 財(cái)報(bào)亮眼:AI 已成第二增長曲線
- 8 9 a16z最新AI百強(qiáng)榜:硅谷頂級VC帶你讀懂全球生成式AI賽道最新趨勢
- 10 Manus跑路,大廠掉線,只能靠DeepSeek了