linux中apache、nginx的proxy反向代理配置
2022/1/14 7:08:29
本文主要是介绍linux中apache、nginx的proxy反向代理配置,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
apache-proxy-配置反向代理.conf
<VirtualHost *:80> DocumentRoot "/www/admin/www.ikugui.cc_9527/wwwroot/public/" ServerName "1636965547" ServerAlias zb.ikugui.cc #代理设置 SSLProxyEngine On ProxyRequests Off ProxyPreserveHost On RequestHeader set Host zb.ikugui.cc ProxyPass / http://111.229.53.23:8099// ProxyPassReverse / http://111.229.53.23:8099// CustomLog "|/usr/local/phpstudy/system/module/rotatelogs /www/admin/www.ikugui.cc_9527/log/apache_access_%Y-%m-%d.log 86400 480" combined_with_cookie RewriteEngine on RewriteCond %{HTTPS} !=on RewriteRule ^(.*) https://%{SERVER_NAME}$1 [L,R] </VirtualHost> <VirtualHost *:443> DocumentRoot "/www/admin/www.ikugui.cc_9527/wwwroot/public/" ServerName "1636965547" ServerAlias "zb.ikugui.cc" #开启SSL SSLEngine on SSLCertificateFile "/usr/local/phpstudy/certs/zb.ikugui.cc/zb.ikugui.cc_apache_public.crt" SSLCertificateKeyFile "/usr/local/phpstudy/certs/zb.ikugui.cc/zb.ikugui.cc_apache.key" SSLCertificateChainFile "/usr/local/phpstudy/certs/zb.ikugui.cc/zb.ikugui.cc_apache_chain.crt" SSLProtocol all -SSLv3 #代理设置 SSLProxyEngine On ProxyRequests Off ProxyPreserveHost On RequestHeader set Host zb.ikugui.cc ProxyPass / http://111.229.53.23:8099// ProxyPassReverse / http://111.229.53.23:8099// CustomLog "|/usr/local/phpstudy/system/module/rotatelogs /www/admin/www.ikugui.cc_9527/log/apache_access_%Y-%m-%d.log 86400 480" combined_with_cookie </VirtualHost>
nginx-proxy-配置反向代理.conf
server{ listen 80 ; server_name zb.ikugui.cc ; #代理配置 location /{ proxy_set_header X-Original-Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host zb.ikugui.cc:$server_port; proxy_pass http://111.229.53.23:8099//; } access_log /www/admin/www.ikugui.cc_9527/log/nginx_access_$logdate.log main; rewrite ^(.*)$ https://$host$1 permanent; } server{ listen 443 ssl; server_name zb.ikugui.cc; #开启SSL ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #证书文件 ssl_certificate /usr/local/phpstudy/certs/zb.ikugui.cc/zb.ikugui.cc_nginx_public.crt; ssl_certificate_key /usr/local/phpstudy/certs/zb.ikugui.cc/zb.ikugui.cc_nginx.key; #代理配置 location /{ proxy_set_header X-Original-Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host zb.ikugui.cc:$server_port; proxy_pass http://111.229.53.23:8099//; } access_log /www/admin/www.ikugui.cc_9527/log/nginx_access_$logdate.log main; }
nginx容器的配置demo
server { listen 80; server_name localhost; location / { root /usr/share/nginx/html/public; index index.html index.htm index.php; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html/public; } location ~ \.php$ { fastcgi_pass php:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /www/public/$fastcgi_script_name; include fastcgi_params; } }
这篇关于linux中apache、nginx的proxy反向代理配置的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-10-29Nginx发布学习:从入门到实践的简单教程
- 2024-10-28Nginx发布:新手入门教程
- 2024-10-21nginx 怎么设置文件上传最大20M限制-icode9专业技术文章分享
- 2024-10-17关闭 nginx的命令是什么?-icode9专业技术文章分享
- 2024-09-17Nginx实用篇:实现负载均衡、限流与动静分离
- 2024-08-21宝塔nginx新增8022端口方法步骤-icode9专业技术文章分享
- 2024-08-21nginx配置,让ws升级为wss访问的方法步骤-icode9专业技术文章分享
- 2024-08-15nginx ws代理配置方法步骤-icode9专业技术文章分享
- 2024-08-14nginx 让访问带有/relid的地址返回404 ,例子 /relid-x-0.36-y-131.html-icode9专业技术文章分享
- 2024-08-14nginx 判断地址有/statics/的路径,指向到/home/html/statics/目录-icode9专业技术文章分享