Last active
June 30, 2020 06:51
-
-
Save vanduc1102/2183f2d3ddc92b1d6bb64342aa40bbab to your computer and use it in GitHub Desktop.
Setup apache2 virtual hosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SetEnv DB_USER root | |
SetEnv DB_PASSWORD test | |
SetEnv DB_HOST db | |
###### All content of apache2.config | |
Listen 7001 | |
<VirtualHost *:7001> | |
DocumentRoot /var/www/html/api.local | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
</VirtualHost> | |
Listen 7002 | |
<VirtualHost *:7002> | |
ServerAdmin webmaster@localhost | |
DocumentRoot /var/www/html/a.local | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
</VirtualHost> | |
#### in php file | |
# $_SERVER['DB_HOST'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/hosts | |
127.0.0.1 api.local | |
127.0.0.1 a.local |
Virtual Host configuration
<VirtualHost *:80>
DocumentRoot /app/public
<Directory "/app/public">
AllowOverride all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you are with Docker, Dont forget to map the port to the
host
e.g: