Q. How do I start / stop / restart Nginx webserver under FreeBSD operating systems? How do I test Nginx web server config file syntax before restarting my server?
A. FreeBSD comes with Nginx startup script located at /usr/local/etc/rc.d directory.
Update /etc/rc.conf
All you have to do is add following line to your /etc/rc.conf file:
nginx_enable="YES"
Once added use the following command to control nginx web server. You must be root user to control nginx.
Start Nginx Web Server Command
# /usr/local/etc/rc.d/nginx start
Stop Nginx Web Server Command
# /usr/local/etc/rc.d/nginx stop
Restart Nginx Web Server Command
# /usr/local/etc/rc.d/nginx restart
Test Nginx config file for errors
The -t option will just test the configuration file. nginx checks configuration for correct syntax and then try to open files referred in configuration.
# nginx -c /usr/local/etc/nginx/nginx.conf -t
Sample output:
?2008/10/09 19:24:26 [info] 52494#0: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok 2008/10/09 19:24:26 [info] 52494#0: the configuration file /usr/local/etc/nginx/nginx.conf was tested successfully
Once statisfied, restart / start Nginx:
# /usr/local/etc/rc.d/nginx start
The -c /path/to/config/file specifies which configuration file Nginx should use instead of the default.
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop














{ 1 comment… read it below or add one }
I need help to uninstall nginx from my boyfriends computer!
So can ou please help me!