I have a website example.com
served by Apache, and example2.com
redirected to port 3001 (using NodeJS). It works with this config:
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /home/www/example
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.example2.com
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:3001/$1 [P,L]
ProxyPass / http://localhost:3001/
ProxyPassReverse / http://localhost:3001/
</VirtualHost>
Now I would like to have this (because I won't renew the domain example2.com
):
example.com
=> served by Apache =>/home/www/example
example.com/website2
=> redirected to the NodeJS website using 3001 (the one previously served onexample2.com
)
Question: I'm about to use the following code, but is it a correct use of Directory
?
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /home/www/example
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
Require all granted
</Directory>
<Directory /website2/>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:3001/$1 [P,L]
ProxyPass / http://localhost:3001/
ProxyPassReverse / http://localhost:3001/
</Directory>
</VirtualHost>