0
点赞
收藏
分享

微信扫一扫

【C++】知识点汇总(下)

yellowone 2024-01-05 阅读 17

 一、创建容器

二、配置端口,以及容器卷挂载

1-创建目录
[root@syf ~]# mkdir -p /data/dockerData/nginx/conf/
[root@syf ~]# cd /data/dockerData/nginx/conf/

2-vim nginx.config


#全局块
#user  nobody;
worker_processes  1;

#event块
events {
    worker_connections  1024;
}

#http块
http {
    #http全局块
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    #server块
    server {
        #server全局块
        listen       80;
        server_name  localhost;
        #location块
        location / {
            root   /usr/share/nginx/html;
     
        }
       
    }
   
}

 配置容器选项:

部署成功

三、连接控制台

3.1进入控制台配置nginx

因为没有vim,所以安装下

更新ubuntu 包管理工具
apt-get update
安装vim
apt-get -y install vim

编辑conf文件:

1-进入nginx配置文件目录
root@edac64fd1776:/etc/nginx# pwd
/etc/nginx
root@edac64fd1776:/etc/nginx# vim nginx.conf 

2-配置80端口,以及静态文件路径
user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


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

    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;

    keepalive_timeout  65;

    #gzip  on;

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

    server{
        listen:80;
        location /{
                root /usr/share/nginx/html;
                }
        }
}
举报

相关推荐

0 条评论