ubuntu 20.04中安装nginx 流程
创始人
2024-11-14 11:33:37
0

ubuntu20.04 安装 nginx 操作流程

1.更新软件包列表

sudo apt update

2.安装最新版本的nginx

sudo apt install nginx

或者安装指定版本的nginx

  • 查看可安装的版本

    sudo apt-cache show nginx

  • 安装指定版本

    sudo apt install nginx=

3.安装完后查看安装的版本

nginx -v

4.路径位置

log: /var/log/nginx

html:/var/www/html

conf:/etc/nginx

5.查看nginx状态

systemctl status nginx

6.停止nginx

sudo systemctl stop nginx

7.启动nginx

sudo systemctl start nginx

8.重启nginx

sudo systemctl restart nginx

9.实例配置文件

user www-data; worker_processes auto;  events {     worker_connections 1024; }  http {     include /etc/nginx/mime.types;     default_type application/octet-stream;      log_format main '$remote_addr - $remote_user [$time_local] "$request" '                       '$status $body_bytes_sent "$http_referer" '                       '"$http_user_agent" "$http_x_forwarded_for"';      access_log /var/log/nginx/access.log main;      sendfile on;     tcp_nopush on;     tcp_nodelay on;     keepalive_timeout 65;      include /etc/nginx/conf.d/*.conf;      upstream backend {         server 127.0.0.1:8080;     }      server {         listen 80;         server_name example.com www.example.com;         root /usr/share/nginx/example;          location / {             try_files $uri $uri/ /index.html;         }          location /api/ {             proxy_pass http://backend;             proxy_set_header Host $host;             proxy_set_header X-Real-IP $remote_addr;             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;             proxy_set_header X-Forwarded-Proto $scheme;         }          location ~ /\.ht {             deny all;         }     }      server {         listen 80;         server_name test.com www.test.com;         root /usr/share/nginx/test;          location / {             try_files $uri $uri/ =404;         }          location /secure/ {             auth_basic "Restricted";             auth_basic_user_file /etc/nginx/.htpasswd;         }     } } 

相关内容

热门资讯

透视法门!aapoker发牌逻... 透视法门!aapoker发牌逻辑(透视)开挂透视平台(哔哩哔哩)1、许多玩家不知道aapoker发牌...
透视教材!hhpoker有没有... 透视教材!hhpoker有没有外开挂,hhpoker有后台操作吗(透视)一直存在有透视器(哔哩哔哩)...
揭秘几款"点星休闲辅... 揭秘几款"点星休闲辅助器下载"真是真的是有辅助插件(有挂教程)-哔哩哔哩1、点星休闲辅助器下载破解器...
透视阶段!智星德州可以透视吗,... 透视阶段!智星德州可以透视吗,wepoker怎么下载游戏(透视)都是存在有挂(哔哩哔哩);一、智星德...
透视模板!wepoker钻石怎... 透视模板!wepoker钻石怎么看底牌(透视)开挂脚本安装(哔哩哔哩)亲,关键说明,wepoker钻...
透视经验!pokemmo免费脚... 透视经验!pokemmo免费脚本,poker world辅助(透视)果然是真的脚本工具(哔哩哔哩)1...
实测揭晓!"丽水都莱... 实测揭晓!"丽水都莱大菠萝辅助"竟然有有辅助方法(有挂方针)-哔哩哔哩进入游戏-大厅左侧-新手福利-...
透视方式!wepoker私人局... 透视方式!wepoker私人局辅助器怎么用,pokemmo辅助工具(透视)果然真的是有挂(哔哩哔哩)...
透视绝活!hhpoker德州透... 透视绝活!hhpoker德州透视(透视)开挂脚本插件(哔哩哔哩)1、hhpoker德州透视透视辅助软...
透视总结!德普之星透视辅助软件... 透视总结!德普之星透视辅助软件,德普之星辅助工具如何设置(透视)好像存在有透视教程(哔哩哔哩);1、...