Created
April 5, 2018 22:40
-
-
Save japodhidev/a5803a88d5f820aafb099e9987c5f168 to your computer and use it in GitHub Desktop.
Apache24 sample VirtualHost configuration
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
# Assumptions made include | |
# 1. Incase you are doing this in a Windows OS development environment, directory | |
# names should be in quotes because spaces will cause lots of errors. | |
# 2. You have your Apache server set to execute PHP source files. | |
# 3. The document root has a file named index.php. | |
<VirtualHost *:80> | |
ServerName www.example.com | |
ServerAlias example.com | |
# Should point to the projects public directory | |
DocumentRoot "var/www/project_dir/public" | |
<Directory "var/www/project-dir/public"> | |
Require all granted | |
DirectoryIndex index.php | |
# This is optional in case you don't like using .htaccess files | |
<IfModule mod_rewrite.c> | |
Options -Multiviews | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.*)$ index.php [QSA,L] | |
</IfModule> | |
</Directory> | |
ErrorLog var/www/project_dir/logs/project_errors.log | |
CustomLog var/www/project_dir/logs/project_access.log | |
# Optional (I just like reading debug and/or error messages) | |
LogLevel warn | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment