从零开始devops-nginx docker
Posted 与技术,求伯乐
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从零开始devops-nginx docker相关的知识,希望对你有一定的参考价值。
nginx
docker compose
version: ‘2.0‘
services:
nginx:
restart: always
image: nginx:latest
ports:
- 80:80
- 7143:7143
- 5342:5342
volumes:
- $NGINX_HOME/conf/nginx.conf:/etc/nginx/nginx.conf
- $NGINX_HOME/conf.d:/etc/nginx/conf.d
- $NGINX_HOME/log:/var/log/nginx
- $NGINX_HOME/html:/var/www
nginx.conf
user nginx;
worker_processes auto;
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;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
default.conf
server {
listen 5342;
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;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
#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;
#}
}
以上是关于从零开始devops-nginx docker的主要内容,如果未能解决你的问题,请参考以下文章