訂閱
糾錯(cuò)
加入自媒體

nginx負(fù)載均衡一些配置的實(shí)戰(zhàn)演示!

(1)解壓nginx:

(2)解壓openssl:

(3)解壓pcre:

(4)解壓zlib:

(5)進(jìn)行配置,先進(jìn)入到nginx里面去,然后執(zhí)行下面語(yǔ)句:

./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

聲明: 本文由入駐維科號(hào)的作者撰寫,觀點(diǎn)僅代表作者本人,不代表OFweek立場(chǎng)。如有侵權(quán)或其他問題,請(qǐng)聯(lián)系舉報(bào)。

發(fā)表評(píng)論

0條評(píng)論,0人參與

請(qǐng)輸入評(píng)論內(nèi)容...

請(qǐng)輸入評(píng)論/評(píng)論長(zhǎng)度6~500個(gè)字

您提交的評(píng)論過于頻繁,請(qǐng)輸入驗(yàn)證碼繼續(xù)

  • 看不清,點(diǎn)擊換一張  刷新

暫無評(píng)論

暫無評(píng)論

    掃碼關(guān)注公眾號(hào)
    OFweek人工智能網(wǎng)
    獲取更多精彩內(nèi)容
    文章糾錯(cuò)
    x
    *文字標(biāo)題:
    *糾錯(cuò)內(nèi)容:
    聯(lián)系郵箱:
    *驗(yàn) 證 碼:

    粵公網(wǎng)安備 44030502002758號(hào)