OpenStack上nginx端口映射

唉~讲真的每次用每次查,有点麻烦了,这次还是都记录下来吧。

docker-run.sh

1
2
3
4
5
6
7
#!/bin/sh

docker run -d --name nginx \
-p 80:80 \
--net host \
-v /home/ubuntu/CA/nginx/nginx.conf:/etc/nginx/nginx.conf \
nginx

nginx.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
user  root;
worker_processes 1;

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

events {
worker_connections 1024;
}


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

sendfile on;

keepalive_timeout 65;


server {
# 直接用公网端口
listen 30271;
server_name 127.0.0.1:8090;

location / {
proxy_pass http://127.0.0.1:8090;
}

}

}