Install with brew
Use brew to install the nginx with command:
After install run:
![Install nginx on mac os Install nginx on mac os](/uploads/1/2/9/3/129327724/238742591.png)
Bitnami NGINX Open Source Stack Virtual Machines Bitnami Virtual Machines contain a minimal Linux operating system with NGINX Open Source installed and configured. Using the Bitnami Virtual Machine image requires hypervisor software such as VMware Player or VirtualBox. Both of these hypervisors are available free of charge. The Web Installer is the easiest way to install Nextcloud on a web space. It checks the dependencies, downloads Nextcloud from the official server, unpacks it with the right permissions and the right user account. It is highly recommended to install OpenResty on our Mac OS X or macOS systems via homebrew package manager, like this: brew tap openresty/brew brew install openresty. If you already installed OpenResty from homebrew/nginx, please run the following command first: brew untap homebrew/nginx.
Testing
Open Navigator it by going to URL:
Configuration
![Nginx Nginx](/uploads/1/2/9/3/129327724/942870221.jpg)
The default place of nginx.conf on Mac after installing with brew is:
Changing the default port (8080)
We shall change it to 80. First stop the nginx server if it is running by:
Update thanks @zue666, @pixel67
if apache is running must also stop
sudo apachectl stop
if apache is running must also stop
sudo apachectl stop
Then open nginx.conf with (example vim):
and change the:
to:
Save configuration and relaunch nginx
Testing
Open Navigator it by going to URL:
Update: thanks @pablohenrique
* ERROR 403 Forbidden - *
dont worry, some other application is already using port 80. probably be skype.
* ERROR 403 Forbidden - *
dont worry, some other application is already using port 80. probably be skype.
1 Solution 1: Change Skype port in Skype > Preferences > advanced
2 Solution 2: No change server { listen to 80.
2 Solution 2: No change server { listen to 80.
That means that nginx will use port 8080 instead of 80. To access it I would use this url
http://localhost:8080.
http://localhost:8080.
Changing the path of defualt web location
he nginx html folder (brew install only) is by the defult in:
Note: change ** 1.2.3 ** to your nginx version.
The defualt path configuration:
To let say Users/to/www:
After change relaunch nginix server and nginx is now serving pages from your custom folder!
enjoy!
Thanks a lot for this project, it's awesome!
The most straightforward default web folder on OSX is probably ~/Sites
To improve the engagement of docker inside my company, i forced people to use this first plug-and-play web server as a mean to make people be impressed by docker capacity.
Also, i feel pretty pleased by the fact that you can finally run services and commands with ?
docker run/exec
on mac seemlessly, thanks a lot for that docker! Also, please note, that homebrew is not even needed anymore and finally webserver's config file are project centric!
Main deamon
Check that 80 and 443 port are free to use!Some very simple steps:
Mac Nginx Config
- Install docker for mac
- Create the docker 'local-nginx-rproxy' network :
docker network create local-nginx-rproxy
- Clone the repo:
git clone [email protected]:9c49d596991dbb47be6b52bfa3bce862.git
- Launch docker containers in background:
docker-compose up -d
- Access nginx: http://localhost
Adding http servers
I added an example with php-fpm, just do these steps:
- docker-compose -f docker-compose-php.yml up -d
- Access php: http://php.localhost
Accessing https
To connect on 443 port, you must create self signed certificates in
~/.certs
.You can use a logic of wildcards certificate, for example: creating those two files
localhost.crt
, localhost.key
in ~/.certs
allows you to access localhost with https!Nginx For Mac
Also if you see this and you know how to improve even further this boilerplate code, please raise your voice.