nginx 反向代理apache2、php-fpm、uwsgi配置
来源:互联网 发布:明城学校网络办公平台 编辑:程序博客网 时间:2024/05/17 01:26
一、nginx反向代理配置样例
#user nobody;worker_processes 4;#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#pid logs/nginx.pid;worker_rlimit_nofile 65535;events { use epoll; worker_connections 4096;}http { include 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 logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 180; client_max_body_size 500m; #gzip on; #反向代理到Apache2 server{listen 80;server_name eblog.com;location / {proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header REMOTE-HOST $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_pass http://127.0.0.1:8888;}}#反向代理,Apache2通过mod_php模式执行php代码server{listen 80;server_name shop.com iloveismarthome.com;location / {proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header REMOTE-HOST $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_pass http://127.0.0.1:8888;}}#反向代理,并使用php-fpm进程模式执行php代码 server{listen80;server_name yaf.api.com;index index.php;root /var/www/yaf_api/public;if (!-e $request_filename) {rewrite ^/(.*) /index.php?$1 last;}location ~ .php$ {fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}access_log /var/log/yaf_api/yaf.api.log;}#反向代理到pythonserver {listen 80;server_name webchat.com;location / { root /var/www/webchat;include uwsgi_params;uwsgi_pass 127.0.0.1:9090; #必须和uwsgi中的设置一致uwsgi_param UWSGI_SCRIPT webchat.wsgi; #入口文件,即wsgi.py相对于项目根目录的位置,“.”相当于一层目录uwsgi_param UWSGI_CHDIR /var/www/webchat; #项目根目录index index.html index.htm;client_max_body_size 35m;}} # HTTPS server #server {listen 443 ssl;server_name test.com;access_log logs/https-access.log;error_log logs/https-error.log;ssl on;#HTTPS服务端ssl_certificate /home/web/myssl/server-cert.pem;ssl_certificate_key /home/web/myssl/server-key.pem;#HTTPS双向验证,客户端密钥设置ssl_client_certificate /home/web/myssl/ca-cert.pem;ssl_verify_client on;ssl_session_cache shared:SSL:1m;ssl_session_timeout 5m;ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;ssl_prefer_server_ciphers on; error_page 500 502 503 504 /50x.html;location = /50x.html { root html;}location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:8888}}}
注:uwsgi配置可以参考 nginx + uwsgi 部署python django web服务
阅读全文
0 0
- nginx 反向代理apache2、php-fpm、uwsgi配置
- nginx代理php-fpm配置
- nginx 集群配置 nginx 反向代理配置 nginx php 集群
- Nginx--反向代理、负载均衡、缓存、fpm
- nginx php-fpm配置
- nginx php-fpm配置
- nginx配置php-fpm
- nginx配置php-fpm
- nginx反向代理配置
- nginx反向代理配置
- nginx反向代理配置
- Nginx 配置反向代理
- nginx反向代理配置
- nginx反向代理配置
- Nginx反向代理配置
- nginx配置反向代理
- nginx反向代理配置
- Nginx反向代理配置
- datagridview控件界面开发
- android 字符长度限制
- mysql binlog分析
- Eclipse快捷键
- JVM系列一:JVM内存组成及分配
- nginx 反向代理apache2、php-fpm、uwsgi配置
- Introduction to TensorFlow Lite
- 易飞软件乱码显示不正常
- 重磅开源!678页阿里核心技术,免费下载!
- 宽平稳和严平稳的区别
- 使用tensorflow的lstm网络进行时间序列预测
- mysql5.7中group by限制
- LUA 排序算法和性能分析[5]:插入排序算法
- ElasticsearchDemo