HTTP 反嚮代理。
另請參閱: netstat ufw Nginx 1.15.6 文檔編製
基本語法 基本用法 詳細用法 配置 Nginx 測試 Nginx 重啓 Nginx
nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]
選項參數
| 參數 | EN 解釋 | 中文翻譯 | 備注 |
|---|---|---|---|
| -?,-h | this help | 此幫助 | |
| -v | show version and exit | 展示版本並退齣 | |
| -V | show version and configure options then exit | 展示版本和配置選項,然後退齣 | |
| -t | test configuration and exit | 測試配置並退齣 | |
| -T | test configuration, dump it and exit | 測試配置,轉儲它並退齣 | |
| -q | suppress non-error messages during configuration testing | 在配置測試期間,抑製非錯誤消息 | |
| -s signal | send signal to a master process: stop, quit, reopen, reload | 把信號發送給主進程:停止 離開 重新打開 重裝 | |
| -p prefix | set prefix path (default: /usr/share/nginx/) | 設置前綴路徑 (默認:/usr/share/nginx/) | |
| -c filename | set configuration file (default: /etc/nginx/nginx.conf) | 設置配置文件 (默認:/etc/nginx/nginx.conf) | |
| -g directives | set global directives out of configuration file | 設置配置文件外的全局指令 |
| 功能 | 命令 | 文字解釋 | 示例 | 示例解釋 |
|---|---|---|---|---|
| 幫助 | nginx -? | 展示幫助信息 | ||
| nginx -h | ||||
| 版本 | nginx -v | 展示版本信息 | ||
| nginx -V | 展示版本信息 配置選項 |
apt-get update --> apt-get dist-upgrade --> apt-get install nginx --> dpkg -l nginx (查看 nginx 版本) --> shutdown -r +1 查看 http://localhost/ 或 http://127.0.0.1/ 或 http://47.244.22.120/ --> 若齣現 Welcome to nginx! 信息,說明安裝成功
移除 Nginx
apt-get purge nginx* --> apt-get autoremove find / -name nginx | xargs rm -rf
目錄結構
虛擬主機 vi /etc/nginx/sites-available/default 配置文件 vi /etc/nginx/nginx.conf 啓動程序 vi /usr/sbin/nginx 日誌文件 sudo vi /var/log/nginx/access.log sudo vi /var/log/nginx/error.log 默認根 /var/www/html /usr/share/nginx/html
ps -ef --> ps aux|grep nginx --> killall nginx --> service nginx start apt-get purge nginx* --> apt-get autoremove netstat -ntpl
防火牆
ufw status (查看防火牆) --> 若為 Status: inactive (ufw disable),則 ufw enable (啓用防火牆) --> ufw allow 20/tcp --> ufw allow 21/tcp --> ufw allow 22/tcp (SSH 專用端口) sudo ufw app list --> ufw allow "Nginx Full"
cd /etc/nginx/sites-available vi /etc/nginx/sites-available/default --> :set nu --> :set tabstop=4 chmod -R 777 /etc/nginx/sites-available
重載配置
/usr/sbin/nginx -s reload service nginx reload (systemctl reload nginx.service)
/usr/sbin/nginx -t --> ps -aux | grep nginx nginx -c /etc/nginx/nginx.conf --> service nginx status
/etc/init.d/nginx stop 或 service nginx stop (systemctl stop nginx.service) /etc/init.d/nginx start 或 service nginx start (systemctl start nginx.service) /etc/init.d/nginx restart 或 service nginx restart (systemctl restart nginx.service)
版權聲明: 本文為獨傢原創稿件,版權歸 樂數軟件 ,未經許可不得轉載。