docker安装nginx

1.查找镜像

成都创新互联公司是一家专注于成都网站建设、做网站与策划设计,平阳网站建设哪家好?成都创新互联公司做网站,专注于网站建设十多年,网设计领域的专业建站公司;建站业务涵盖:平阳等地区。平阳做网站价格咨询:13518219792

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.测试

当前标题:docker安装nginx
文章转载:https://www.cdcxhl.com/article18/isjigp.html

成都网站建设公司_创新互联,为您提供网站制作网站设计自适应网站关键词优化定制网站微信小程序

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

搜索引擎优化