Note that there are some explanatory texts on larger screens.

plurals
  1. POVirtual Hosts (Apache) with mod_rewrite issues
    text
    copied!<p>I am trying to fix this whole day without success, so I hope someone might be able to help me. I have an app at <code>http://localhost/</code>, and it uses Pylons for the app I am hosting. In addition to that, I need to host a PHP/MySQL site, so I had to use Apache too.</p> <p>My current setup is that I use haproxy with this config for the Apache backend:</p> <pre><code>backend apache mode http timeout connect 4000 timeout server 30000 timeout queue 60000 balance roundrobin server app02-8002 localhost:8002 maxconn 1000 </code></pre> <p>This is triggered by this:</p> <pre><code>acl image url_sub images use_backend apache if image </code></pre> <p>So, when I open my IP/images, it will trigger that and open Apache then, with port 8002.</p> <p>For Apache, I created virtual hosts, and this is the "image" one:</p> <pre><code>&lt;VirtualHost *:8002&gt; ServerAdmin my@email.com ServerName image ServerAlias image DocumentRoot /srv/www/image/public_html/ ErrorLog /srv/www/image/logs/error.log CustomLog /srv/www/image/logs/access.log combined &lt;/VirtualHost&gt; </code></pre> <p>So, that all works nicely, when I type IP/images it open the /srv/www/image/public_html. But then the issues come. As I am using the image uploading script, it involves a lot of rewriting, so I had to enable that mod. This is the .htaccess which is located in the public_html/images folder (I somehow had to make this subfolder too, to "match" the URL with the actual location in the public_html. SetEnv PHP_VER 5_3</p> <pre><code>RewriteEngine On # You must define your installation directory and uncomment the line : RewriteBase /images/ RewriteRule ^([a-zA-Z]+)\.(jpg|gif|png|wbmp)$ controller/Resizer.php?m=original&amp;a=$1&amp;e=$2 [L] RewriteRule ^(icon|small|medium|square)\/([a-zA-Z]+)\.(jpg|gif|png|wbmp)$ controller/Resizer.php?m=$1&amp;a=$2&amp;e=$3 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule (.*) application.php?request=$1 [L,QSA] </code></pre> <p>So, basically, this is somethow not working. I suppose there is a conflict between this virtual host, subdirectory, rewriting or something, but I can't seem to isolate it.</p> <p>It is a bit confusing that when I open the IP/images/xxxx.jpg it opens the image, which is located in the public_html/images/upload/original folder, so the rewrite is working. The the other rules seem not to be working. All of the thumbnails and smaller versions are not rendering properly (with the icon, small, medium, square), so that makes the site quite unsusable.</p> <p>Here is the link of the development server: <code>http://localhost/images/</code></p> <p>Thanks in advance for your time and help!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload