docker安装nginx
admin
2023-02-28 20:21:06
0

1.查找镜像

docker search nginx

docker安装nginx

2.拉取镜像

docker pull nginx

docker安装nginx

3.创建挂载目录

mkdir conf

mkdir develop

ls

docker安装nginx

4.进入conf目录,创建nginx.conf配置文件

# gzip设置

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;

        # 其作用是按顺序检查文件是否存在,返回第一个找到的文件或文件夹(结尾加斜线表示为文件夹),如果所有的文件或文件夹都找不到,会进行一个内部重定向到最后一个参数。

        #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.查看容器状态
docker安装nginx

7.测试


相关内容

热门资讯

今日重磅消息“欢乐岛.怎么开挂... 今日重磅消息“欢乐岛.怎么开挂?”确实真的有挂您好,欢乐岛这个游戏其实有挂的,确实是有挂的,需要了解...
终于懂了“可乐麻将.辅助开挂神... 有 亲,根据资深记者爆料可乐麻将是可以开挂的,确实有挂(咨询软件无需打开...
今日重大通报“YY棋牌.有没有... 家人们!今天小编来为大家解答YY棋牌透视挂怎么安装这个问题咨询软件客服徽9784099的挂在哪里买很...
最新引进“蜀友汇.真的有挂吗?... 网上科普关于“蜀友汇有没有挂”话题很是火热,小编也是针对蜀友汇作*弊开挂的方法以及开挂对应的知识点,...
我来教教您“情怀娱乐.怎么开挂... 家人们!今天小编来为大家解答情怀娱乐透视挂怎么安装这个问题咨询软件客服徽9752949的挂在哪里买很...
玩家分享攻略“广客账本.可以开... 您好:广客账本这款游戏可以开挂,确实是有挂的,需要了解加客服微信【9752949】很多玩家在这款游戏...
终于了解“极酷牛牛.可以开挂吗... 您好:极酷牛牛这款游戏可以开挂,确实是有挂的,需要了解加客服微信【9752949】很多玩家在这款游戏...
终于懂了“火神炸金花.开挂神器... 终于懂了“火神炸金花.开挂神器?”果然有透视挂您好,火神炸金花这个游戏其实有挂的,确实是有挂的,需要...
今日重大消息“福建众娱.辅助器... 您好:福建众娱这款游戏可以开挂,确实是有挂的,需要了解加客服微信【9752949】很多玩家在这款游戏...
玩家分享攻略“欢乐贰柒拾.怎么... 有 亲,根据资深记者爆料欢乐贰柒拾是可以开挂的,确实有挂(咨询软件无需打...