欧美一区2区三区4区公司二百,国产精品婷婷午夜在线观看,自拍偷拍亚洲精品,国产美女诱惑一区二区

歡迎來到云服務(wù)器

系統(tǒng)配置

Nginx的安裝和配置過程記錄

1.安裝說明:

系統(tǒng)環(huán)境:Ubuntu 14.04.3 LTS

軟件:nginx-1.8.0.tar.gz

安裝位置:/opt/nginx

2.安裝

需要用到的安裝包:

openssl-fips-2.0.10.tar.gz

zlib-1.2.8.tar.gz

pcre-8.37.tar.gz

nginx-1.8.0.tar.gz

安裝順序依次為:openssl、zlib、pcre, 然后安裝Nginx包

2.1安裝openssl-fips-2.0.2.tar.gz

tar –zxvf openssl-fips-2.0.10.tar.gz

cd openssl-fips-2.0.10

./config

make

make install

2.2 安裝zlib-1.2.8.tar.gz

tar –zxvf zlib-1.2.8.tar.gz

cd zlib-1.2.8

./configure

make

make install

2.3安裝pcre-8.37.tar.gz (需安裝編譯c++環(huán)境: apt-get install build-essential)

在安裝pcre-8.37.tar.gz之前需要安裝c++編譯環(huán)境,否則在執(zhí)行./configure時(shí)會報(bào)錯(cuò)。

apt-get install build-essential

tar –zxvf pcre-8.37.tar.gz

cd pcre-8.37

./configure

make

make install

2.4安裝nginx-1.8.0.tar.gz

tar -zxvf nginx-1.8.0.tar.gz

cd nginx-1.8.0

./configure --with-pcre=../pcre-8.37 --with-zlib=../zlib-1.2.8 --with-openssl=../openssl-fips-2.0.10

make

make install

至此Nginx的安裝完成!

檢測nginx是否安裝成功

cd /usr/local/nginx/sbin

./nginx –t

出現(xiàn)如下所示提示,表示安裝成功

[email protected] :/usr/local/nginx/sbin# ./nginx -t

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

啟動nginx

./ngixn

查看端口:

netstat -tnlp  | grep nginx

[email protected] :/usr/local/nginx/sbin# netstat -tnlp | grep nginx

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      2957/nginx

并且通過瀏覽器訪問

3.nginx負(fù)載均衡配置

打開 /usr/local/nginx/conf/nginx.conf 配置文件,做如下配置即可:

user  root root;
worker_processes  1;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
error_log  logs/error.log  warn;
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;
    #設(shè)定負(fù)載均衡的服務(wù)器列表
    upstream myserver{
     server 192.168.1.171:8080;
                 server 192.168.1.172:8080;
                 server 192.168.1.173:8080;
    }
    #偵聽服務(wù)器信息
    server {
        listen       80;
        server_name  192.168.1.110;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
        location / {
                         #root   html;
                         #index  index.html index.htm;
                         proxy_pass http://myserver;
                         proxy_redirect off;
                         proxy_set_header Host $host;
                         proxy_set_header X-Real-IP $remote_addr;
                         #后端的Web服務(wù)器可以通過X-Forwarded-For獲取用戶真實(shí)IP
                         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        #error_page  404              /404.html;
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ .php$ {
        #    proxy_pass   http://127.0.0.1;
        #}
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ .php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}
        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /.ht {
        #    deny  all;
        #}
    }
    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;
    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
}

騰訊云代理

Copyright © 2003-2021 MFISP.COM. 國外vps服務(wù)器租用 夢飛云服務(wù)器租用 版權(quán)所有 ? 粵ICP備11019662號

主站蜘蛛池模板: 伊吾县| 诏安县| 盐源县| 柯坪县| 波密县| 庄浪县| 尼勒克县| 绥棱县| 青浦区| 仁怀市| 承德市| 手机| 依安县| 尉犁县| 万年县| 乐至县| 兰溪市| 林芝县| 杭州市| 德安县| 阳城县| 唐山市| 集安市| 明水县| 衡南县| 海口市| 定兴县| 堆龙德庆县| 洪雅县| 城市| 道真| 临潭县| 定日县| 延安市| 茌平县| 科技| 林州市| 饶阳县| 漯河市| 司法| 惠安县|