Apache反向代理无法加载js css img
Apache反向代理无法加载js css img
反向代理配置
<code><proxy> Order deny,allow Allow from all </proxy> ProxyPass /roadcloud/ http://www.roadcloud.com.cn/ ProxyPassReverse /roadcloud/ http://www.roadcloud.com.cn/</code>
反向代理后的网页
我设置了 /roadcloud 反向代理到www.roadcloud.com.cn,
www.roadcloud.com.cn的第一级目录能被代理,但二级目录及以下的都不能被代理,如
我的域名为:www.mcmxzl.com
要代理:http://www.roadcloud.com.cn/templates/index/default/images/slider_1.jpg
代理后链接本应是:https://www.mcmxzl.com/roadcloud/templates/index/default/images/slider_1.jpg
实际却是:https://www.mcmxzl.com/templates/index/default/images/slider_1.jpg
回复内容:
Apache反向代理无法加载js css img
反向代理配置
<code><proxy> Order deny,allow Allow from all </proxy> ProxyPass /roadcloud/ http://www.roadcloud.com.cn/ ProxyPassReverse /roadcloud/ http://www.roadcloud.com.cn/</code>
反向代理后的网页
我设置了 /roadcloud 反向代理到www.roadcloud.com.cn,
www.roadcloud.com.cn的第一级目录能被代理,但二级目录及以下的都不能被代理,如
我的域名为:www.mcmxzl.com
要代理:http://www.roadcloud.com.cn/templates/index/default/images/slider_1.jpg
代理后链接本应是:https://www.mcmxzl.com/roadcloud/templates/index/default/images/slider_1.jpg
实际却是:https://www.mcmxzl.com/templates/index/default/images/slider_1.jpg
你的目的应该是想让http://www.mcmxzl.com/roadcloud/去代理http://www.roadcloud.com.cn/
问题是直接这么写反向代理是会把原来的路径带上的,也就是说你现在的情况是,你直接访问http://www.mcmxzl.com/roadcloud/templates/获得的是http://www.roadcloud.com.cn/roadcload/templates/的结果,所以正如你的截图,图片显示不出来,必须要http://www.mcmxzl.com/templates/这样访问才能拿到http://www.roadcloud.com.cn/templates/的结果,是这样子的现象吧?这个跟nginx的表现是一样的,你要让apache自动把/roadcloud去掉,是需要重写url的,apache我不太懂,帮你搜了一个,你看看吧。
https://segmentfault.com/a/1190000000406581
我设置了 /roadcloud 反向代理到www.roadcloud.com.cn,
www.roadcloud.com.cn的第一级目录能被代理,但二级目录及以下的都不能被代理,如
我的域名为:www.mcmxzl.com
要代理:http://www.roadcloud.com.cn/templates/index/default/images/slider_1.jpg
代理后链接本应是:https://www.mcmxzl.com/roadcloud/templates/index/default/images/slider_1.jpg
实际却是:https://www.mcmxzl.com/templates/index/default/images/slider_1.jpg

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Solve the problem of third-party interface returning 403 in Node.js environment. When we use Node.js to call third-party interfaces, we sometimes encounter an error of 403 from the interface returning 403...

The OKX trading platform can be downloaded through mobile devices (Android and iOS) and computers (Windows and macOS). 1. Android users can download it from the official website or Google Play, and they need to pay attention to security settings. 2. iOS users can download it through the App Store or follow the official announcement to obtain other methods. 3. Computer users can download the client of the corresponding system from the official website. Always make sure to use official channels when downloading, and register, log in and security settings after installation.

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

Many website developers face the problem of integrating Node.js or Python services under the LAMP architecture: the existing LAMP (Linux Apache MySQL PHP) architecture website needs...

Mastering Debian system log monitoring is the key to efficient operation and maintenance. It can help you understand the system's operating conditions in a timely manner, quickly locate faults, and optimize system performance. This article will introduce several commonly used monitoring methods and tools. Monitoring system resources with the sysstat toolkit The sysstat toolkit provides a series of powerful command line tools for collecting, analyzing and reporting various system resource metrics, including CPU load, memory usage, disk I/O, network throughput, etc. The main tools include: sar: a comprehensive system resource statistics tool, covering CPU, memory, disk, network, etc. iostat: disk and CPU statistics. mpstat: Statistics of multi-core CPUs. pidsta

How to avoid the third-party interface returning 403 error in the Node environment. When calling the third-party website interface using Node.js, you sometimes encounter the problem of returning 403 error. �...

The problem of comparing and synchronizing BeyondCompare files: Case sensitivity failure when using Beyond...

PHP and Laravel are not directly comparable, because Laravel is a PHP-based framework. 1.PHP is suitable for small projects or rapid prototyping because it is simple and direct. 2. Laravel is suitable for large projects or efficient development because it provides rich functions and tools, but has a steep learning curve and may not be as good as pure PHP.
