Hi Guys,
Setting up your environment can be such a headache when you just acquired a new system especially for mac users but have no fear, I will be showing you sone steps today that will combat this problem. This is intended for laravel users trying to configure their mac environment without using homestead, follow the instructions below
#create name of the website here
sudo nano /etc/hosts
127.0.0.1 localhost
127.0.0.1 sitename.local. <— create your own site name
#Make a dir called Sites in your home dir by typing the below command
$ mkdir Sites
#User document file should look like this
/Users/yourusername/Sites
# navigate to the users directory cd /etc/apache2/users/
# create this file and edit $ sudo nano username.conf #
<Directory "/Users/YOUR_USER_NAME/Sites/"> AllowOverride All Options Indexes MultiViews FollowSymLinks Require all granted </Directory>
#Don’t forget to replace YOUR_USER_NAME with your username.
$ sudo chmod 644 username.conf
# now Configuring the httpd.conf file
# navigate to apache2
$ cd /etc/apache2/
Inside this directory we have the httpd.conf file.
As a good practice we will make a backup copy of the httpd.conf file by typing the following command.
$ sudo cp httpd.conf httpd.conf.backup
Now open the httpd.conf file using vi and uncomment the following lines.
$ sudo nano httpd.conf
To uncomment the lines remove the # from the start of the line.
LoadModule authz_core_module libexec/apache2/mod_authz_core.so LoadModule authz_host_module libexec/apache2/mod_authz_ host.so LoadModule userdir_module libexec/apache2/mod_userdir.so LoadModule include_module libexec/apache2/mod_include.so LoadModule rewrite_module libexec/apache2/mod_rewrite.so LoadModule php7_module libexec/apache2/libphp7.so
Uncomment the following line for User home directories.
Do this settings below
#DocumentRoot "/Library/WebServer/Documents" #<Directory "/Library/WebServer/Documents"> DocumentRoot "/Users/username/Sites/" <Directory "/Users/username/Sites/"> Options FollowSymLinks Multiviews MultiviewsMatch Any AllowOverride All Require all granted </Directory>
Configuring the httpd-userdir.conf file
In the terminal type the following command to go to the extra directory.
$ cd /etc/apache2/extra/
As a good practice create a backup copy of the httpd-userdir.conf file.
$ sudo cp httpd-userdir.conf httpd-userdir.conf.backup
Now open the file using vi.
$ sudo nano httpd-userdir.conf
Include /private/etc/apache2/users/*.
$ sudo apachectl configtest
Syntax OK
Now restart Apache using the following command.
$ sudo apachectl restart
navigate here and do the setup below /etc/apache2/extra/httpd-
<VirtualHost *:80> DocumentRoot "/Users/username/Sites/sitename/public" ServerName sitename.local </VirtualHost>
# remember the sitename and the username above is your own sitename and username.
Activate virtual hosts in apache
Uncomment the following line (remove the #) in /private/etc/apache2/httpd.conf
#Include /private/etc/apache2/extra/httpd-vhosts.conf
#credits : https://dyclassroom.com/howto-mac/how-to-install-apache-mysql-php-on-macos-catalina-10-15
-
Previous Post
Laravel 6 auth