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文件
在平時(shí)的開發(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
這個(gè)文件原本內(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個(gè)字
最新活動(dòng)更多
-
6月20日立即下載>> 【白皮書】精準(zhǔn)測量 安全高效——福祿克光伏行業(yè)解決方案
-
7月3日立即報(bào)名>> 【在線會(huì)議】英飛凌新一代智能照明方案賦能綠色建筑與工業(yè)互聯(lián)
-
7月22-29日立即報(bào)名>> 【線下論壇】第三屆安富利汽車生態(tài)圈峰會(huì)
-
7.30-8.1火熱報(bào)名中>> 全數(shù)會(huì)2025(第六屆)機(jī)器人及智能工廠展
-
7月31日免費(fèi)預(yù)約>> OFweek 2025具身機(jī)器人動(dòng)力電池技術(shù)應(yīng)用大會(huì)
-
免費(fèi)參會(huì)立即報(bào)名>> 7月30日- 8月1日 2025全數(shù)會(huì)工業(yè)芯片與傳感儀表展
推薦專題
- 1 AI 眼鏡讓百萬 APP「集體失業(yè)」?
- 2 大廠紛紛入局,百度、阿里、字節(jié)搶奪Agent話語權(quán)
- 3 深度報(bào)告|中國AI產(chǎn)業(yè)正在崛起成全球力量,市場潛力和關(guān)鍵挑戰(zhàn)有哪些?
- 4 上海跑出80億超級(jí)獨(dú)角獸:獲上市公司戰(zhàn)投,干人形機(jī)器人
- 5 國家數(shù)據(jù)局局長劉烈宏調(diào)研格創(chuàng)東智
- 6 一文看懂視覺語言動(dòng)作模型(VLA)及其應(yīng)用
- 7 下一代入口之戰(zhàn):大廠為何紛紛押注智能體?
- 8 百億AI芯片訂單,瘋狂傾銷中東?
- 9 Robotaxi新消息密集釋放,量產(chǎn)元年誰在領(lǐng)跑?
- 10 格斗大賽出圈!人形機(jī)器人致命短板曝光:頭腦過于簡單