Apache
Changing your Apache Server Root Directory
Your Apache installation determines what content to serve based on the DocumentRoot Default directory.
DocumentRoot Default = /var/www/html
-document root configured in the following files:
sudo vim /etc/apache2/sites-available/000-default.conf
sudo vim /etc/apache2/apache2.conf
Application Port Settings
After installing Apache, there will be a default configuration file located in /etc/apache/enabled-sites/
that contains some VirtualHost configuration settings. It can be modified using Apache modules to allow Apache to serve our application as our root domain. To do this, we will need to enable one of the following Apache mods using sudo a2enmod <module name>
So, we run..
sudo a2enmod proxy_http
sudo a2enmod mod_proxy
After these two modules install, set up your VirtualHost configuration within the /etc/apache/enabled-sites/ directory as follows:
<VirtualHost *:80>
ServerAdmin me@mydomain.com
ServerAlias mydomain.com
ServerName www.mydomain.com
ProxyPreserveHost On
# setup the proxy
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass / http://www.mydomain.com:8888/
ProxyPassReverse / http://www.mydomain.com:8888/
</VirtualHost>
To apply these settings, runĀ sudo systemctl restart apache2.service
to restart Apache and reload your new configuration. If this command returns an error, look closer at your config settings and be sure you enabled the necessary modules.
No Comments