LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices

Reply
 
Search this Thread
Old 11-08-2013, 10:51 AM   #1
coryjsanders
LQ Newbie
 
Registered: Apr 2010
Location: Phoenix
Posts: 12

Rep: Reputation: 0
apache2 rewrite rules for virtual machines


I am trying to use rewrite rules to direct certain URLs to the Virtual Machines on my ProxMox server.

Below I will list the contents of my /etc/apache2/sites-available/pve.conf and pve-redirect.conf

My public IP is on eth0. So you get to the ProxMox gui by going my.pub.lic.ip:8006

The Virtual Machines are on vmbr0 and running on 10.10.10.x

I want mycustomer.mydomain.com (which is being directed from my hosting provider to my.pub.lic.ip) to be received by Apache and redirected to the internal server address.


Here is /pve.conf:

<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 1
MaxSpareServers 2
MaxClients 50
MaxRequestsPerChild 200
</IfModule>

ServerName localhost
ServerSignature Off
ServerTokens Prod
ServerAdmin root
AddDefaultCharset On

# Hint1: Ajax use KeepAlive. We wnat that to get better performance.
# Hint2: We need to limit the number of request to avoid exhaustive
# memory usage (we still have small memory leaks).
# Apache KeepAlive in effect disables MaxRequestsPerChild,
# (max request are MaxRequestsPerChild*MaxKeepAliveRequests)
# so we implemented and additional limit in REST.pm

# But KeepAlive spawns too many processes - so we disable that for now
KeepAlive off
MaxKeepAliveRequests 200

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/json
</IfModule>

CustomLog ${APACHE_LOG_DIR}/access.log combined

Listen 8006
<VirtualHost *:8006>
SSLEngine on
SSLProtocol all -SSLv2
SSLCertificateFile /etc/pve/local/pve-ssl.pem
SSLCertificateKeyFile /etc/pve/local/pve-ssl.key

RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]

DocumentRoot /usr/share/pve-manager/root
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory /usr/share/pve-manager/root>
Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Directory /usr/share/pve-manager/css>
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Directory /usr/share/pve-manager/ext4>
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Directory /usr/share/pve-manager/images>
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Directory /usr/share/vncterm>
AllowOverride None
Order allow,deny
allow from all
</Directory>

Alias /pve2/css/ /usr/share/pve-manager/css/
Alias /pve2/ext4 /usr/share/pve-manager/ext4/
Alias /pve2/images/ /usr/share/pve-manager/images/
Alias /vncterm/ /usr/share/vncterm/

# avoid authentication when accessing favicon
Alias /favicon.ico /usr/share/pve-manager/images/favicon.ico

PerlRequire /usr/share/pve-manager/startup.pl

<Location /index.pl>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options ExecCGI
</Location>

<Location /api2/>
SetHandler perl-script
PerlHandler PVE::REST
</Location>

</VirtualHost>

Here is pve-redirect.conf:

<VirtualHost *:80>
#RewriteLog "/root/rewrite.log"
#RewriteLogLevel 10
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
RewriteRule ^/(.*) https://%{HTTP_HOST}:8006/$1 [L,R]
</VirtualHost>

<VirtualHost *:443>
SSLEngine on
SSLProtocol all -SSLv2
SSLCertificateFile /etc/pve/local/pve-ssl.pem
SSLCertificateKeyFile /etc/pve/local/pve-ssl.key

RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
RewriteRule ^/(.*) https://%{HTTP_HOST}:8006/$1 [L,R]
</VirtualHost>

Thanks.
 
Old 11-08-2013, 03:54 PM   #2
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,935
Blog Entries: 1

Rep: Reputation: 188Reputation: 188
PLEASE use code tags
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wordpress multisite rewrite rules vv22 Linux - Server 0 10-26-2012 02:06 AM
Nginx Virtual Hosts & Wordpress Rewrite Rules Coburn64 Linux - Server 1 09-15-2010 01:58 PM
[SOLVED] Debian, Lenny, suEXEC, Apache2, .htaccess rewrite rules don't work anymore. Mogget Linux - Server 1 07-10-2010 06:33 PM
ReWrite Rules dereko Linux - Software 0 04-30-2008 10:54 AM
Need help with Apache rewrite rules?? latino Programming 0 12-24-2004 02:09 AM


All times are GMT -5. The time now is 06:43 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration