In this tutorial, I would like to show how to configure and install nginx on Mac OS X. My Mac system is Mavericks 10.9.2.
You have to install Xcode command line tools.
Heavily borrowed from: Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory. Install nginx brew install nginx cd /usr/local/etc/nginx/ git clone [email protected]:fountainhead/nginx-sites-available sites-available wget ".
1. Download the latest stable version – nginx 1.4.7.
2. Unzip the downloaded package by the command “tar xvzf nginx-1.4.7.tar.gz”.
- Compile nginx with openssl on Mac OS X 64-bit Print Email Details Written by Chau Hong Linh Category: Computer Science. Mac OS X's kernel is based on Mach and Open BSD, which is a Unix-based system. It used to be very convenient to compile native C code on Mac OS X, until Snow Leopard. From Snow Leopard until now, it becomes worse and worse.
- Xiao Ling / April 6, 2014 October 29, 2019 / Mac / Mac, nginx 3 comments In this tutorial, I would like to show how to configure and install nginx on Mac OS X. My Mac system is Mavericks 10.9.2.
3. “cd nginx-1.4.7”.
4. “sudo ./configure”. There is an error displayed:
5. To fix the error, visit the tutorial page and read “Building nginx from Sources”, in which you can find the link of PCRE library.
6. Go to PCRE official site, and find the latest version of PCRE library on SourceForge.
7. Download the package and unzip it by the command “tar xvzf pcre-8.34.tar.bz2”.
8. Now, you can run the configure file again with the parameters “sudo ./configure –with-pcre=path”.
9. Configuration is done.
the default nginx path prefix is “/usr/local/nginx”.
10. To install nginx, type in “sudo make install”.
11. Find the executable file “cd /usr/local/nginx/sbin”
12. Launch nginx “sudo ./nginx”
The nginx is successfully running now!
If you have any questions, just email {desmond at dynamsoft dot com}.
Install with brew
Use brew to install the nginx with command:
After install run:
Testing
Open Navigator it by going to URL:
Configuration
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!
Nginx Reverse Proxy Mac Os X
enjoy!