Config Apache with domain and subdomain
-
Hello, now I have a strange problem and I need a solution from you! I have tried before according to the Apache documentation to execute but it did not work.
I have a non-standard application in which I want to run soon and I will have it configured like this:
- "website.com" - is the domain where the application will be enabled and running from the CDN.
- Create an "alias" under the subdomain that is "update.website.com" without the CDN and with Cloudron authentication.
I will need this for the purpose of updating the app to bypass conflicts during updates and a decent backup.
Why this? I have the application in the "public" folder, and the maintenance and update message page in the "html" folder.
Then using Apache config, I change the location of the application from the main domain to the sub-domain "update", and on the main domain the update message. In this way, I can safely make a copy and update the application well without losing the CDN configuration.
-
What is the question ?
-
Just creating multiple VirtualHost should work. Something like below works for me.
ServerName %{HTTP_HOST} <VirtualHost *:80> ServerName main.smartserver.io DocumentRoot /app/data/public/main LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy CustomLog "|/bin/cat" proxy ErrorLog "|/bin/cat" <Directory /app/data/public/main> Options +FollowSymLinks AllowOverride All Require all granted </Directory> # Do not remove this include. It's required for your app to see the Real IP Include "/app/code/apache/rpaf.conf" </VirtualHost> <VirtualHost *:80> ServerName update.smartserver.io DocumentRoot /app/data/public/update LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy CustomLog "|/bin/cat" proxy ErrorLog "|/bin/cat" <Directory /app/data/public/update> Options +FollowSymLinks AllowOverride All Require all granted </Directory> # Do not remove this include. It's required for your app to see the Real IP Include "/app/code/apache/rpaf.conf" </VirtualHost>