docker安裝nginx

1.查找鏡像

成都創(chuàng)新互聯(lián)公司是一家專注于成都網(wǎng)站建設(shè)、做網(wǎng)站與策劃設(shè)計,平陽網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)公司做網(wǎng)站,專注于網(wǎng)站建設(shè)十多年,網(wǎng)設(shè)計領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:平陽等地區(qū)。平陽做網(wǎng)站價格咨詢:13518219792

docker search nginx

docker安裝nginx

2.拉取鏡像

docker pull nginx

docker安裝nginx

3.創(chuàng)建掛載目錄

mkdir conf

mkdir develop

ls

docker安裝nginx

4.進入conf目錄,創(chuàng)建nginx.conf配置文件

# gzip設(shè)置

gzip on;

gzip_vary on;

gzip_comp_level 6;

gzip_buffers 16 8k;

gzip_min_length 1000;

gzip_proxied any;

gzip_disable "msie6";

#gzip_http_version 1.0;

gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;

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;

? ? ? ? # 其作用是按順序檢查文件是否存在,返回第一個找到的文件或文件夾(結(jié)尾加斜線表示為文件夾),如果所有的文件或文件夾都找不到,會進行一個內(nèi)部重定向到最后一個參數(shù)。

? ? ? ? #try_files $uri /index.html;

? ? #}

? ? 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;

? ? #}

}

5.啟動容器

docker run --name nginx -p 80:80 --privileged=true -v /usr/local/docker/nginx/conf/nginx.conf:/etc/nginx/conf.d/default.conf -v /usr/local/docker/nginx/develop/dist/:/usr/share/nginx/html/ -d nginx
docker安裝nginx

6.查看容器狀態(tài)
docker安裝nginx

7.測試

當(dāng)前標(biāo)題:docker安裝nginx
文章轉(zhuǎn)載:http://muchs.cn/article18/isjigp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作、網(wǎng)站設(shè)計、自適應(yīng)網(wǎng)站關(guān)鍵詞優(yōu)化、定制網(wǎng)站微信小程序

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化