国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

首頁(yè) 運(yùn)維 Nginx nginx怎麼配置

nginx怎麼配置

Nov 01, 2019 am 10:45 AM
nginx

設(shè)定nginx的方法:首先要開啟「/etc/nginx/conf.d/」資料夾;然後建立設(shè)定檔;接著在「/etc/nginx/nginx.conf」檔案中修改設(shè)定項(xiàng);最後重新啟動(dòng)nginx即可。

nginx怎麼配置

Nginx是一款輕量級(jí)的Web 伺服器/反向代理伺服器及電子郵件(IMAP/POP3)代理伺服器

Nginx (engine x) 也是一個(gè)高效能的HTTP和反向代理服務(wù),也是一個(gè)IMAP/POP3/SMTP服務(wù)。 Nginx是由伊戈?duì)枴べ愃饕驗(yàn)槎砹_斯訪問量第二的Rambler.ru站點(diǎn)(俄文:Рамблер)開發(fā)的? ?(建議學(xué)習(xí):nginx教程

前後端nginx設(shè)定

1.開啟/etc/nginx/conf.d/資料夾,建立設(shè)定檔xxx.conf,內(nèi)容如下:

server {
    listen 80;
    server_name **.106.2**.175;
    location / {
            root   /public/app/dist;
            index  index.php index.html index.htm;
    }
    location /sell {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   Host      $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_pass         http://127.0.0.1:8080;
        proxy_redirect off;
    }}

在/etc /nginx/nginx.conf檔案中有一行就是把剛剛設(shè)定的引進(jìn)總的nginx設(shè)定中

...
    include /etc/nginx/conf.d/*.conf;...

3.設(shè)定完成後重新啟動(dòng)nginx

nginx -t                         # 查看nginx狀態(tài)
nginx -s reload            # 重新載入配置文件
nginx -s reopen           # 重啟 Nginx
nginx -s stop               # 停止 Nginx

#設(shè)定https?

 server {
         listen 443;
         server_name xx.name.com;
         ssl on;
         index index.html index.htm;
         ssl_certificate   cert/215079423330181.cert;
         ssl_certificate_key  cert/215079423330181.key;
         ssl_session_timeout 5m;
         ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
         ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
         ssl_prefer_server_ciphers on;
         location / { 
            root   /public/app/dist;
            index  index.php index.html index.htm;
         }
         location /sell {
             proxy_set_header   X-Real-IP $remote_addr;
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
             proxy_set_header   Host      $http_host;
             proxy_set_header X-NginX-Proxy true;
             proxy_pass         http://127.0.0.1:8080;
             proxy_redirect off;
         }
    }

nginx.conf 預(yù)設(shè)檔案

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    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  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    gzip on;
    gzip_static on;
    gzip_min_length 1024;
    gzip_buffers 4 16k;
    gzip_comp_level 2;
    gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript   application/x-httpd-php application/vnd.ms-fontobject font/ttf font/opentype font/x-woff image/svg+xml;
    gzip_vary off;
    gzip_disable "MSIE [1-6]\.";

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

    server {
         listen 443;
         server_name mp.hanxing.store;
         ssl on;
         index index.html index.htm;
         ssl_certificate   cert/cert_mp.hanxing.store.crt;
         ssl_certificate_key  cert/cert_mp.hanxing.store.key;
         ssl_session_timeout 5m;
         ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
         ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
         ssl_prefer_server_ciphers on;
         location / { 
            root   /public/sell/app/dist;
            index  index.php index.html index.htm;
         }
         location /sell {
             proxy_set_header   X-Real-IP $remote_addr;
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
             proxy_set_header   Host      $http_host;
             proxy_set_header X-NginX-Proxy true;
             proxy_pass         http://127.0.0.1:8080;
             proxy_redirect off;
         }
         error_page 404 /404.html;
              location = /40x.html {
         }
         error_page 500 502 503 504 /50x.html;
            location = /50x.html {
         }
    }
}

以上是nginx怎麼配置的詳細(xì)內(nèi)容。更多資訊請(qǐng)關(guān)注PHP中文網(wǎng)其他相關(guān)文章!

本網(wǎng)站聲明
本文內(nèi)容由網(wǎng)友自願(yuàn)投稿,版權(quán)歸原作者所有。本站不承擔(dān)相應(yīng)的法律責(zé)任。如發(fā)現(xiàn)涉嫌抄襲或侵權(quán)的內(nèi)容,請(qǐng)聯(lián)絡(luò)admin@php.cn

熱AI工具

Undress AI Tool

Undress AI Tool

免費(fèi)脫衣圖片

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅(qū)動(dòng)的應(yīng)用程序,用於創(chuàng)建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費(fèi)的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費(fèi)的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強(qiáng)大的PHP整合開發(fā)環(huán)境

Dreamweaver CS6

Dreamweaver CS6

視覺化網(wǎng)頁(yè)開發(fā)工具

SublimeText3 Mac版

SublimeText3 Mac版

神級(jí)程式碼編輯軟體(SublimeText3)

nginx在windows中怎麼配置 nginx在windows中怎麼配置 Apr 14, 2025 pm 12:57 PM

如何在 Windows 中配置 Nginx?安裝 Nginx 並創(chuàng)建虛擬主機(jī)配置。修改主配置文件並包含虛擬主機(jī)配置。啟動(dòng)或重新加載 Nginx。測(cè)試配置並查看網(wǎng)站。選擇性啟用 SSL 並配置 SSL 證書。選擇性設(shè)置防火牆允許 80 和 443 端口流量。

docker怎麼啟動(dòng)容器 docker怎麼啟動(dòng)容器 Apr 15, 2025 pm 12:27 PM

Docker 容器啟動(dòng)步驟:拉取容器鏡像:運(yùn)行 "docker pull [鏡像名稱]"。創(chuàng)建容器:使用 "docker create [選項(xiàng)] [鏡像名稱] [命令和參數(shù)]"。啟動(dòng)容器:執(zhí)行 "docker start [容器名稱或 ID]"。檢查容器狀態(tài):通過 "docker ps" 驗(yàn)證容器是否正在運(yùn)行。

docker容器名稱怎麼查 docker容器名稱怎麼查 Apr 15, 2025 pm 12:21 PM

可以通過以下步驟查詢 Docker 容器名稱:列出所有容器(docker ps)。篩選容器列表(使用 grep 命令)。獲取容器名稱(位於 "NAMES" 列中)。

怎麼查看nginx是否啟動(dòng) 怎麼查看nginx是否啟動(dòng) Apr 14, 2025 pm 01:03 PM

確認(rèn) Nginx 是否啟動(dòng)的方法:1. 使用命令行:systemctl status nginx(Linux/Unix)、netstat -ano | findstr 80(Windows);2. 檢查端口 80 是否開放;3. 查看系統(tǒng)日誌中 Nginx 啟動(dòng)消息;4. 使用第三方工具,如 Nagios、Zabbix、Icinga。

docker怎麼創(chuàng)建容器 docker怎麼創(chuàng)建容器 Apr 15, 2025 pm 12:18 PM

在 Docker 中創(chuàng)建容器: 1. 拉取鏡像: docker pull [鏡像名] 2. 創(chuàng)建容器: docker run [選項(xiàng)] [鏡像名] [命令] 3. 啟動(dòng)容器: docker start [容器名]

nginx怎麼啟動(dòng) nginx怎麼啟動(dòng) Apr 14, 2025 pm 01:06 PM

問題:如何啟動(dòng) Nginx?答案:安裝 Nginx啟動(dòng) Nginx驗(yàn)證 Nginx 是否已啟動(dòng)探索其他啟動(dòng)選項(xiàng)自動(dòng)啟動(dòng) Nginx

在Nginx和Apache之間進(jìn)行選擇:適合您的需求 在Nginx和Apache之間進(jìn)行選擇:適合您的需求 Apr 15, 2025 am 12:04 AM

NGINX和Apache各有優(yōu)劣,適合不同場(chǎng)景。 1.NGINX適合高並發(fā)和低資源消耗場(chǎng)景。 2.Apache適合需要復(fù)雜配置和豐富模塊的場(chǎng)景。通過比較它們的核心特性、性能差異和最佳實(shí)踐,可以幫助你選擇最適合需求的服務(wù)器軟件。

centos下phpstorm性能優(yōu)化方法 centos下phpstorm性能優(yōu)化方法 Apr 14, 2025 pm 05:30 PM

提升CentOS系統(tǒng)下PhpStorm性能的實(shí)用技巧本文提供多種方法,幫助您優(yōu)化CentOS系統(tǒng)中PhpStorm的性能,從而提高開發(fā)效率。在實(shí)施任何優(yōu)化措施前,請(qǐng)務(wù)必備份重要數(shù)據(jù)并在測(cè)試環(huán)境中驗(yàn)證效果。一、系統(tǒng)級(jí)優(yōu)化精簡(jiǎn)系統(tǒng)服務(wù):禁用不必要的系統(tǒng)服務(wù)和守護(hù)進(jìn)程,減少系統(tǒng)資源占用。無(wú)界面模式:如果不需要圖形界面,切換到無(wú)界面模式可顯著節(jié)省資源。卸載冗余軟件:移除不再使用的軟件包和服務(wù),釋放系統(tǒng)資源。二、PHP配置優(yōu)化啟用OPcache:安裝并配置OPcache擴(kuò)展,顯

See all articles