ConceptΒΆ
Install nginx via package managerΒΆ
DebianΒΆ
RedhatΒΆ
Build From SourceΒΆ
Download Nginx source code from this page then extract tar file, like this
./configure nginx with this parameters:
--sbin-path=/usr/bin/nginx nginx executable binary file path
--conf-path=/etc/nginx/nginx.conf nginx configuration file path
--error-log-path=/var/log/nginx/error.log nginx error log path
---http-log-path=/var/log/nginx/access.log nginx access log path
---with-pcre regex module for nginx
--pid-path=/var/run/nginx.pid nginx running process location
--with-http_ssl_module nginx 3rd party module
make
make install
Save this file as /lib/systemd/system/nginx.service to create systemctl unit
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Nginx Official SiteΒΆ
Check Nginx Config FileΒΆ
Documentation & ReferenceΒΆ
- Hub Nginx Docs Awesome
- Official Documentation
- nginx.org docs
- Nginx Best Practice Configuration
- DigitalOcean Tutorial
- Nginx for Wordpress
Nginx GEO IPΒΆ
Build GEO IP From SourceΒΆ
add `--with-http_geoip_module` to configure
fix error dependency with `apt install libgeoip-dev`
make
make install
download GeoIP and GeoLiteCity package from maxmind