Good content takes time and effort to come up with.
Please consider supporting us by just disabling your AD BLOCKER and reloading this page again.
MAMP pro comes with loaded features, one of the main attraction is Hosts Management. Many of them who use
Symfony like frameworks need to start the server and restart for any small modifications in main configuration files.
This is kinda frustrating for developers as this itself becomes big headache. If your not using MAMP Pro and looking for to setup the MAMP then you are at the right place.
I hope that you might be having
Symfony kind of frameworks in
/Applications/MAMP/htdocs folder. If still not then go ahead and install one now.
I am using
PHP Laravel framework as an example. Please feel free to use any other framework as per your needs.
Start MAMP server on top left corner go to
MAMP -> Preferences -> Ports
You will something like the following configuration
As you see in the above image I am having
Apache Port : 8888
Nginx Port : 8888
MYSQL Port : 8889
You can reset it to default ports by clicking on
Set Web & MYSQL ports to 80 & 3306
Then your ports will be as follows
Apache Port : 80
Nginx Port : 80
MYSQL Port : 3306
I am leaving for the default one. As in my docker file our company uses port
3306 as default ports for
Open your Laravel
.env file make sure to make the following changes
I am taking
stackcoderas laravel project and stackcoder.test for local development domain as an EXAMPLE :)
APP_URL - Observe
8888 port, And as you see
http://stackcoder.test is the domain which will be pointing to your
Laravel app in
DB_PORT - Observe
APP_DEBUG=true APP_URL=http://stackcoder.test:8888 DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=8889
httpd-vhosts.confFile To Add Your Virtual Hosts For APACHE
Run the following command.
sudo nano /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
This will open the
httpd-vhosts.conf file where you need to add the following configuration.
The following code block is mandatory. Don't make any changes to it.
NameVirtualHost *:8888 <VirtualHost *:8888> DocumentRoot /Applications/MAMP/htdocs ServerName localhost </VirtualHost>
Below the above code add your project settings
<VirtualHost *:8888> DocumentRoot "/Applications/MAMP/htdocs/stackcoder/public/" ServerName stackcoder.test </VirtualHost>
DocumentRoot "/Applications/MAMP/htdocs/stackcoder/public/" this point to your Laravel project
ServerName stackcoder.test - You can add any domain name for testing
httpd-vhosts.conf will look something like the following
NameVirtualHost *:8888 <VirtualHost *:8888> DocumentRoot /Applications/MAMP/htdocs ServerName localhost </VirtualHost> <VirtualHost *:8888> DocumentRoot "/Applications/MAMP/htdocs/stackcoder/public/" ServerName stackcoder.test </VirtualHost> <VirtualHost *:8888> DocumentRoot "/Applications/MAMP/htdocs/some_other_project/public/" ServerName otherproject.test </VirtualHost>
You can add as many projects you need.
stackcoder.testVirtual Host Name In
Now you have added virtual hosts settings its time to setup
stackcoder.test in the
127.0.0.1 localhost stackcoder.test otherproject.test someotherproject.test
Just go to MAMP and restart (stop & start servers) your MAMP sever
Now go to your browser and add the following in the url
Make sure to put
8888 port you have not set port
80 as default port
Once the development of the web application is complete you will be pushing to server. I have curated and written few articles on the same kindly read those.
How To Do Basic Server Security Setup For Ubuntu / Linux
How To Install Linux, NGINX, MYSQL, PHP (LEMP Stack) on Ubuntu
How To Install Linux, Apache, MYSQL, PHP (LAMP Stack) on Ubuntu
Supervisor For Laravel Queue Scheduling
Push Files To CPanel / Remote Server using FTP Software FileZilla
Facebook Login With PHP Laravel Socialite
Generate RSS Feeds in PHP Laravel
Lazy Load Images In Chrome With This Simple Trick
Sass or SCSS @mixin vs @extends vs Placeholder (%)
Search Engine Optimization Concepts
Manipulate HTML Using DOMDocument In PHP
Automate Repeating Tasks In Linux Server With Cronjobs
Move Uploaded Files From Local Computer Or Server To Amazon S3 Bucket In PHP
Accessors & Mutators In Laravel. Problem In Set Attribute While Saving/Updating Data & How To Resolve It