Table of Contents
回复内容:
Home Backend Development PHP Tutorial Apache反向代理无法加载js css img

Apache反向代理无法加载js css img

Jun 06, 2016 pm 08:10 PM
apache php windows

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>
Copy after login
Copy after login

反向代理后的网页
Apache反向代理无法加载js css img

我设置了 /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>
Copy after login
Copy after login

反向代理后的网页
Apache反向代理无法加载js css img

我设置了 /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

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve the problem of third-party interface returning 403 in Node.js environment? How to solve the problem of third-party interface returning 403 in Node.js environment? Mar 31, 2025 pm 11:27 PM

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...

How to download okx trading platform How to download okx trading platform Mar 26, 2025 pm 05:18 PM

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.

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

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.

How to efficiently integrate Node.js or Python services under LAMP architecture? How to efficiently integrate Node.js or Python services under LAMP architecture? Apr 01, 2025 pm 02:48 PM

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...

How to monitor system performance through Debian logs How to monitor system performance through Debian logs Apr 02, 2025 am 08:00 AM

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 third-party interfaces returning 403 errors in Node environment? How to avoid third-party interfaces returning 403 errors in Node environment? Apr 01, 2025 pm 02:03 PM

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. �...

What should I do if Beyond Compare fails to case sensitivity when synchronizing Windows and Linux files? What should I do if Beyond Compare fails to case sensitivity when synchronizing Windows and Linux files? Apr 01, 2025 am 08:06 AM

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

Which is better PHP or Laravel? Which is better PHP or Laravel? Mar 27, 2025 pm 05:31 PM

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.

See all articles