user root;
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;
server_name www.vimiao.net;
location /img {
alias /usr/share/nginx/file;
}
location / {
root /usr/share/nginx/html; #对应的文件夹
index index.html index.htm;
}
}
#server {
# listen 80;
# server_name www.nbfyb.com;
#
# location /img {
# alias /usr/share/nginx/file;
# }
#
# location / {
# root /usr/share/nginx/html; #对应的文件夹
# index index.html index.htm;
# }
#}
server {
listen 80;
server_name www.nbfyb.com;
return 301 https://$host$request_uri;
#return 307 https://$host$request_uri; 可以跳转post请求
}
server {
listen 443;
server_name www.nbfyb.com;
ssl on;
index index.html;
ssl_certificate /usr/share/nginx/file/6879522_www.nbfyb.com.pem;
ssl_certificate_key /usr/share/nginx/file/6879522_www.nbfyb.com.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
root /usr/share/nginx/html; #对应的文件夹
index index.html index.htm;
}
location /img {
alias /usr/share/nginx/file;
}
location /front {
proxy_pass http://lbs;
proxy_redirect default;
}
}
upstream lbs {
server 121.41.67.2:9002;
#server 121.40.127.122:8080;
}
}
?? ??
docker run -d -p 80:80 -p 443:443 --name nginx \
-v /usr/docker/nginx/www:/usr/share/nginx/html \
-v /usr/docker/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /usr/docker/nginx/logs:/var/log/nginx \
-v /usr/docker/nginx/file:/usr/share/nginx/file nginx
|