
Modules
https://www.nginx.com/resources/wiki/modules/index.html
Command
sudo systemctl start nginx
sudo systemctl status nginx
open port 80 / 443
sudo ufw enable
sudo ufw allow 'Nginx HTTP'
sudo ufw allow 'Nginx HTTPS'
sudo ufw allow 'Nginx Full'
sudo ufw reload
sudo ufw status
การติดตั้ง Nginx
sudo apt-get install nginx
ที่ตั้งค่าของไฟล์ path ของ .conf
/etc/nginx/nginx.conf /etc/nginx/conf.d/*
nginx.conf
http {
include /opt/local/etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
server_names_hash_max_size 1024;
}
Include files
include /opt/local/etc/nginx/mime.types; include /opt/local/etc/nginx/vhost/*.conf;
upstream servers
Single
Multitple
Memcached
FastCGI run PHP behide NGINX
SCGI
uWSGI
nginx.conf
# /etc/nginx/nginx.conf
# the upstream component nginx needs to connect to upstream educa { server unix:///tmp/educa.sock; } server { listen 80; server_name www.educaproject.com educaproject.com; location / { include /etc/nginx/uwsgi_params; uwsgi_pass educa; } }
การสร้าง Server Block
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/example.com
หลังจาก copy แล้ว เข้าไปแก้ไฟล์
sudo nano /etc/nginx/sites-available/example.com
สามารถใช้ tool ช่วยได้ ที่ https://www.digitalocean.com/community/tools/nginx
เปิดใช้งาน server block ของเรา
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
การทดสอบ Nginx Server
sudo nginx -t
Reload
sudo service nginx restart
sudo systemctl restart nginx
sudo /etc/init.d/nginx restart /*