docker nginx

docker run -p 8080:80 --name nginx_web -v /opt/gnss/nginx/html:/usr/share/nginx/html -v /opt/gnss/nginx/log:/var/log/nginx -v /opt/gnss/nginx/nginx.conf/:/etc/nginx/nginx.conf -v /opt/gnss/nginx/conf.d/:/etc/nginx/conf.d:rw -d nginx

在/opt/gnss/nginx/conf.d新增default.conf

server {

? ? listen? ? ? 80;

? ? server_name? localhost;

? ? #charset koi8-r;

? ? #access_log? /var/log/nginx/host.access.log? main;

? ? location / {

? ? ? ? root? /usr/share/nginx/html;

? ? ? ? index? index.html index.htm;

? ? }

? ? #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? /usr/share/nginx/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;

? ? #}


? ? location /gnss-admin/api/ {

? ? ? ? proxy_redirect off;?

? ? ? ? proxy_set_header Host $host;?

? ? ? ? proxy_set_header X-Real-IP $remote_addr;?

? ? ? ? proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

? ? ? ? proxy_pass http://172.17.0.1:8088/gnss-admin/api/;

? ? }

}

#安裝vim

apt-get update

apt-get install vim

開啟gzip壓縮,vi nginx.conf:

gzip on;

? ? gzip_min_length 1k;

? ? gzip_buffers 4 16k;

? #gzip_http_version 1.0;

? ? gzip_comp_level 2;

? ? gzip_types text/plain application/javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;

? ? gzip_vary off;

? ? gzip_disable "MSIE [1-6]\.";

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容