Wednesday, December 26, 2018

Nginx on FreeBSD: 1 - Installation /Uninstall

Installation:
# pkg install nginx
If you check the which shell
# echo $SHELL

Enable Ngnix service
rc is a FreeBSD utility that controls the system's automatic boot processes.Scripts for every service available on the system are located in the /usr/local/etc/rc.d directory. These define the parameters that are used to enable each service using the rcvar variable
# grep rcvar /usr/local/etc/rc.d/*


After has been installed, this command will output a listing similar to this:
Output
/usr/local/etc/rc.d/cloudconfig:rcvar="cloudinit_enable" /usr/local/etc/rc.d/cloudinitlocal:rcvar="cloudinit_enable" /usr/local/etc/rc.d/nginx:rcvar=nginx_enable /usr/local/etc/rc.d/rsyncd:rcvar=rsyncd_enable
The parameter that you need to set for the nginx service is highlighted here in this output. The name of the script itself — the last component of the path before the colon — is also helpful to know, as that's the name that FreeBSD uses to refer to the service.
To enable the nginx service you must add its rcvar to the rc.conf file, which holds the global system configuration information referenced by the startup scripts. Use your preferred editor to open the /etc/rc.conf file with sudo privileges. Here, we'll use 
# sudo ee /etc/rc.conf
/etc/rc.conf
. . .
sshd_enable="YES"
nginx_enable="YES"

IPFW is a stateful firewall written for FreeBSD.

Directly below the nginx_enable parameter you just added, add the following highlighted lines:
/etc/rc.conf
. . .
nginx_enable="YES"
firewall_enable="YES"
firewall_type="workstation"
firewall_myservices="22/tcp 80/tcp"
firewall_allowservices="any"
For the first time to run the server (in csh or tcsh shells, freeBSD)
# nohup service ipfw start >&/tmp/ipfw.log

Stop, start and restart the ipfw service.
# sudo service ipfw stop
# sudo service ipfw start
# sudo service ipfw restart

Start the Nginx service:
# service nginx start

Stop Ngnix:
# service nginx stop
# rm -f -R /usr/local/nginx && rm -f /usr/local/sbin/nginx
# rm -rf /var/www
# sysrc nginx_enable=no
http://192.168.10.114/
OR, to see the public ip address: 
# curl -4 icanhazip.com

To setting Up a server Block using a domain name.


Uninstall Nginx:
From ports:
# service nginx stop
# cd /usr/ports/www/nginx && make deinstall
Check the liestening ports
# sockstat -4 -l




1 comment:

  1. Easy Busy: Nginx On Bsd: 1 - Installation /Uninstall >>>>> Download Now

    >>>>> Download Full

    Easy Busy: Nginx On Bsd: 1 - Installation /Uninstall >>>>> Download LINK

    >>>>> Download Now

    Easy Busy: Nginx On Bsd: 1 - Installation /Uninstall >>>>> Download Full

    >>>>> Download LINK kH

    ReplyDelete