#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2016
    Posts
    1
    Rep Power
    0

    What is the best way to setup a server in a Mac?


    Hi, there are several ways to run an Apache or Nginx server in a mac for PHP development.

    1) Install the server through brew
    2) Install from source
    3) Install through packages like Wamp, Xampp and Laragon

    Out of these what do you think is the best? For my scenario, I do not want to run the server all the time especially not everytime the machine starts.
  2. #2
  3. Maddening Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,504
    Rep Power
    9645
    1 or 3, whichever you would prefer.

    The web server will take minimal resources when not in use. It's fine to just let it run all the time.
  4. #3
  5. No Profile Picture

    Join Date
    Jun 2017
    Location
    San Diego
    Posts
    3
    Rep Power
    0
    Hi,


    Apache is natively included with macOS, To install nginx through brew,

    brew install nginx
    The following will automatically launch Nginx at startup:
    brew services start nginx
    We want to store our web site in the folder of our choice, and access to the URL 301 Moved Permanently.
    To do this, edit the configuration file:
    nano /usr/local/etc/nginx/nginx.conf
    To begin, we edit the line beginning with Nginx #user to give permission to access our files, to modify the following line, where <user> is your username:
    user <user> staff;
    To use port 80, changing the line beginning with listen in :
    listen 80;
    Finally, it indicates the folder where you want to store your sites through the variable root :
    root <chemin/vers/votre/site>;
    We can now start Nginx:
    sudo nginx

    Hope this will help to install Nginx.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    93
    Rep Power
    5
    I am going to suggest Docker. Then you wouldn't have to install every single tool onto your server. Instead, you can run a few commands and have a new server up within a few mins! Don't like Apache? Cool, you can switch over to NGINX within a few seconds. https://docs.docker.com/docker-for-m...d-run-examples.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2015
    Posts
    75
    Rep Power
    3
    My suggestion is to use docker or vagrant for your PHP development.

    You can check Laravel Homestead - https://github.com/laravel/homestead

IMN logo majestic logo threadwatch logo seochat tools logo