Last active
February 1, 2019 07:42
-
-
Save oychao/245111f7fda699dff05a7d89183bf797 to your computer and use it in GitHub Desktop.
nginx configuration
client_max_body_size 128m;
server_names_hash_bucket_size 64;
server {
listen 8080;
server_name chao.ouyang.io;
error_log /data/logs/error.log;
access_log /data/logs/access.log;
location / {
proxy_pass http://10.8.1.17:8000;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
}
}
server {
listen 8080;
server_name *.ouyang.io;
error_log /data/logs/error.log;
access_log /data/logs/access.log;
location / {
proxy_pass http://10.8.1.17:9000;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
}
}
docker run -dit --name abtest-proxy -p 7000:8080 -v /data/dev/abtest/conf.d/:/etc/nginx/conf.d -v /data/dev/abtest/logs/:/data/logs openresty/openresty
server {
listen 4000;
server_name blog;
location / {
root D:/;
autoindex on;
}
access_log D:/nginx-1.14.2/a.log;
error_log D:/nginx-1.14.2/e.log;
}
# demo-react-redux项目的前后端分离
server {
listen 4111; # 监听4111端口
server_name localhost; # 服务名
location / { # 监听路径/
root /Users/ouyangchao/Projects/Smallit/okrSystem/dist/client/; # 前端项目打包编译生成的文件所在的目录
try_files $uri /index.html; # 所有路径均返回该文件
#index index.html;
}
location /data { # 监听路径/data, 后端入口
rewrite /data/(.*) /okrSystemBackEnd/data/$1 break; # 重写请求到指定路径
proxy_pass http://127.0.0.1:8080; # 代理传递到指定服务器及端口
}
location /favicon.ico { # 无视favicon.ico的404错误
log_not_found off;
access_log off;
}
access_log /Users/ouyangchao/Documents/log/nginx/backend.access.log; # 访问日志路径
error_log /Users/ouyangchao/Documents/log/nginx/backend.error.log; # 错误日志路径
}
注意日志文件所在的路径需要手动建立。
location /nodered/ {
rewrite /nodered/(.*) /$1 break;
proxy_pass http://localhost:3880;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment