This is the configuration file for nginx and any associated documentation for utilizing Cloudflare.
https://wiki.freebsd.org/Ports/nginx
https://nginx.org/en/linux_packages.html
When setting up this service, check the nginx.conf file and make sure the file paths match for everything you are serving, or any pertinent SSL certificates.
Cloudflare is an amazing Domain Name Server (DNS). You may purchase or register a DNS from https://www.cloudflare.com/ and point it to your Inernet Protocol Address (IP). Generally speaking, you want the service to be proxied and strict SSL requirements set. You will get your SSL certificates generated by Cloudflare and this is typically the easiest way to handle it yourself without adding another third party service. Remember, the SSL certificaes will be in privkey.pem and fullchain.pem which is important to prevent hijacking your domain name.
Note: You may not have sudo privileges on certain hosting services with BSD. It is not necessary everytime.
sudo pkg install nginxsudo sysrc nginx_enable="YES"sudo service nginx start- Main config:
/usr/local/etc/nginx/nginx.conf - Test config:
sudo nginx -t - Reload after changes:
sudo service nginx reload
sudo apt update
sudo apt install nginxsudo systemctl enable nginx
sudo systemctl start nginx- Main config:
/etc/nginx/nginx.conf - Test config:
sudo nginx -t - Reload after changes:
sudo systemctl reload nginx
sudo dnf install nginx # Fedora/RHEL 8+
sudo yum install nginx # CentOS/RHEL 7sudo systemctl enable nginx
sudo systemctl start nginx- Main config:
/etc/nginx/nginx.conf - Test config:
sudo nginx -t - Reload after changes:
sudo systemctl reload nginx
Visit http://<your-server-ip>/ or https://domain.name in a browser. You should see the default NGINX welcome page or whatever you serve on index.html in your file path.
Please note the difference between HTTP and HTTPS is dependent upon whether you have SSL certification from Cloudflare.
- Check status:
sudo systemctl status nginx(Linux) orsudo service nginx status(FreeBSD) - View logs:
/var/log/nginx/ - Stop service:
sudo systemctl stop nginx(Linux) orsudo service nginx stop(FreeBSD)