常规 nginx 代理apache

nginx:

复制代码
server {
  server_name www.xx.com xx.com;
  access_log /data/wwwlogs/www.xx.com_nginx.log combined;
  index index.html index.htm index.php;
  root /home/f/data/wwwroot/www.xx.com/xx/public;
  if ($host != www.xx.com) {  return 301 $scheme://www.xx.com$request_uri;  }
  ############################## xu add ##########

   #if (!-e $request_filename) {
   #rewrite  ^(.*)$  /index.php?s=/$1  last;
   #break;
   #}

  ############################### end #################################
  location / {
    try_files $uri @apache;
  }
  location @apache {
    proxy_pass http://127.0.0.1:88;
    include proxy.conf;
    proxy_hide_header Upgrade;
  }
  location ~ .*\.(php|php5|cgi|pl)?$ {
    proxy_pass http://127.0.0.1:88;
    include proxy.conf;
    proxy_hide_header Upgrade;
  }
  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
    expires 30d;
    access_log off;
  }
  location ~ .*\.(js|css)?$ {
    expires 7d;
    access_log off;
  }
  location ~ /\.ht {
    deny all;
  }
}
复制代码

 

 

 

apache:

复制代码
<VirtualHost *:88>
  ServerAdmin admin@example.com
  DocumentRoot "/home/f/data/wwwroot/www.xx.com/xx/public"
  ServerName www.xx.com
  ServerAlias xx.com

  ErrorLog "/data/wwwlogs/www.xx.com_error_apache.log"
  CustomLog "/data/wwwlogs/www.xx.com_apache.log" common
<Directory "/home/f/data/wwwroot/www.xx.com/xx/public">
  SetOutputFilter DEFLATE
  Options FollowSymLinks ExecCGI
  Require all granted
  AllowOverride All
  Order allow,deny
  Allow from all
  DirectoryIndex index.html index.php
</Directory>
</VirtualHost>
复制代码

 

简单配置 nginx 转发 Tomcat :

1
2
3
4
5
6
7
8
9
10
11
12
server {
  listen 80;
  server_name shxt.yadanmall.com;
  access_log /data/wwwlogs/shxt.yadanmall.com_nginx.log combined;
  index index.html index.htm index.php;
  root /home/f/data/wwwroot/shxt;
   
   
  location / { 
    proxy_pass http://localhost:8080;
  }
}

  

 

posted @   徐锅  阅读(970)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南

点击右上角即可分享
微信分享提示