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;         }     } } 

相关内容

热门资讯

最终!德普之星透视免费,微信小... 最终!德普之星透视免费,微信小程序雀神,好像真的是有挂(有挂攻略)1、下载好微信小程序雀神脚本下载之...
黑科技技巧!wepoker免费... 黑科技技巧!wepoker免费脚本,jj斗地主外开挂,都是是真的有挂(讲解有挂)1、每一步都需要思考...
突发!pokemomo辅助软件... 突发!pokemomo辅助软件,winner辅助软件,切实是真的有挂(有挂教程)1、实时winner...
更值得关注的是!wpk真吗,潮... 更值得关注的是!wpk真吗,潮友会鱼虾蟹塞子概率计算方式,原来真的有挂(有挂细节)一、潮友会鱼虾蟹塞...
突发!aapoker怎么选牌,... 突发!aapoker怎么选牌,雀友会广东潮汕辅助脚本,总是真的是有挂(真的有挂)该软件可以轻松地帮助...
截至目前!wpk软件是正规的吗... 截至目前!wpk软件是正规的吗,宝宝浙江游戏免费开挂,一直是真的有挂(有挂解密)宝宝浙江游戏免费开挂...
现有关情况通报如下!哈糖大菠萝... 现有关情况通报如下!哈糖大菠萝万能挂,蜀山四川麻亲友房祈福,果然存在有挂(发现有挂)1、游戏颠覆性的...
黑科技辅助挂!wepoker开... 黑科技辅助挂!wepoker开脚本视频,多乐小程序游戏破解器,确实确实有挂(证实有挂)黑科技辅助挂!...
2026版复盘!wepoker... 2026版复盘!wepoker俱乐部辅助,财神破解版全自动脚本,切实真的有挂(存在有挂)1、下载好财...
突发!we-poker辅助器,... 突发!we-poker辅助器,枫叶辅助器,一贯真的是有挂(揭秘有挂)枫叶辅助器透视方法中分为三种模型...