Nginx 服务搭建
来源:互联网 发布:sql视图是什么 编辑:程序博客网 时间:2024/04/20 10:58
参考:http://blog.csdn.net/ysydao/article/details/51388385搭建完成需要进行业务配置upstream upstream_zhishimao{ server 127.0.0.1:8081; }server{ listen 80; listen 443 ssl; ssl_certificate /data/keys/domain.crt; ssl_certificate_key /data/keys/server.key; server_name api2.zhishimao.cn; charset utf-8; root /datat/app/html; index index.html index.htm;# add_header Access-Control-Allow-Origin '*'; add_header Access-Control-Allow-Origin 'http://h52.zhishimao.cn'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Methods' 'GET, POST, DELETE, PUT, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'Accept, Authorization,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; location / { if ($request_method = 'OPTIONS') { add_header 'Access-Control-Allow-Origin' 'http://h52.zhishimao.cn'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Methods' 'GET, POST, DELETE, PUT, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'Accept, Authorization,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; add_header 'Content-Type' 'text/plain charset=UTF-8'; add_header 'Content-Length' 0; return 204; } proxy_pass http://upstream_zhishimao; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; proxy_max_temp_file_size 0; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_temp_file_write_size 64k; } }server { charset utf-8; listen 80; #listen 443 ssl; server_name h52.zhishimao.cn; #ssl_certificate /usr/local/webserver/cert/h5domain.crt; #ssl_certificate_key /usr/local/webserver/cert/h5server.key; root /data/html/zhishimaokouyu-wx/; index index.html; location / { try_files $uri $uri/ /data/html/zhishimaokouyu-wx/index.html; } }upstream upstream_projects{ server 127.0.0.1:9000; }server { listen 80; server_name pro.zhishimao.cn; index index.html; location / { if ( $request_uri = "/" ) { rewrite "/" http://pro.zhishimao.cn:9000/zentaopms/www/index.php break; } #proxy_pass http://pro.zhishimao.cn:9000; proxy_pass http://upstream_projects; } } 配置成功后还有可能出现500 Internal Server Error 可参考 https://www.kafan.cn/edu/80525056.html
阅读全文
0 0
- nginx服务傻瓜搭建
- 搭建nginx+ffmpeg服务
- Nginx linux服务搭建
- nginx认证服务搭建
- nginx服务的搭建
- Nginx 服务搭建
- linux下搭建nginx服务
- nginx搭建hls服务流程
- nginx http服务搭建配置
- ubuntu 服务器搭建nginx服务
- nginx web服务基础搭建
- 搭建sftp服务+nginx代理
- nginx下ftp服务搭建
- nginx[+spawn-fcgi]+flup+webpy服务搭建
- nginx+spawn-fcgi+flup+webpy服务搭建
- Web服务器:linux下搭建nginx服务
- Nginx安装配置与服务搭建
- Nginx安装配置与服务搭建
- Android广播机制——初体验
- 20171017《css权威指南》10-?
- Python徒手实现识别手写数字—简易图片数据库
- springboot项目设置启动
- 【涉及到python的小项目:让鼠标自动点击(一)】sikuli的安装与运行demo
- Nginx 服务搭建
- intellij idea乱码问题
- ROS launch文件的作用和编写
- HDU 1074:Doing HomeWork(状态压缩DP)
- 顺序表应用2:多余元素删除之建表算法
- 求乘法逆元
- 禅道项目管理工具部署
- 用go实现linux命令行
- django manage.py扩展自定义命令