美文网首页
docker 运行 nginx 1.17.6 (2020年4月1

docker 运行 nginx 1.17.6 (2020年4月1

作者: onedam | 来源:发表于2020-04-20 00:20 被阅读0次

docker 运行 nginx 后 目录结构

docker run --name ng1 -v /root/nginxw:/usr/share/nginx/html -p 81:80 -d nginx:1.17.6

docker exec -it ng1 bash 进入nginx容器 查看 nginx info
/etc/nginx/nginx.conf

root@29c14935379c:/etc/nginx# more nginx.conf

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
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;
}

conf.d/defalut.conf

root@29c14935379c:/etc/nginx/conf.d# more 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;
    #}
}

nginx 启动参数

root@29c14935379c:/etc/nginx/conf.d# nginx -V
nginx version: nginx/1.17.6
built by gcc 8.3.0 (Debian 8.3.0-6)
built with OpenSSL 1.1.1c  28 May 2019 (running with OpenSSL 1.1.1d  10 Sep 2019)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.17.6/debian/debuild-base/nginx-1.17.6=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

格式化下

prefix=/etc/nginx 
sbin-path=/usr/sbin/nginx 
modules-path=/usr/lib/nginx/modules 
conf-path=/etc/nginx/nginx.conf 
error-log-path=/var/log/nginx/error.log 
http-log-path=/var/log/nginx/access.log 
pid-path=/var/run/nginx.pid 
lock-path=/var/run/nginx.lock 
http-client-body-temp-path=/var/cache/nginx/client_temp 
http-proxy-temp-path=/var/cache/nginx/proxy_temp 
http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp 
http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp 
http-scgi-temp-path=/var/cache/nginx/scgi_temp 
user=nginx 
group=nginx 
with-compat 
with-file-aio 
with-threads 
with-http_addition_module 
with-http_auth_request_module 
with-http_dav_module 
with-http_flv_module 
with-http_gunzip_module 
with-http_gzip_static_module 
with-http_mp4_module 
with-http_random_index_module 
with-http_realip_module 
with-http_secure_link_module 
with-http_slice_module 
with-http_ssl_module 
with-http_stub_status_module 
with-http_sub_module 
with-http_v2_module 
with-mail 
with-mail_ssl_module 
with-stream 
with-stream_realip_module 
with-stream_ssl_module 
with-stream_ssl_preread_module 
with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.17.6/debian/debuild-base/nginx-1.17.6=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' 
with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,as-needed -pie'

相关文章

网友评论

      本文标题:docker 运行 nginx 1.17.6 (2020年4月1

      本文链接:https://www.haomeiwen.com/subject/bycvbhtx.html