Ubuntu20.02使用nginx
1.介绍Nginx是一款高性能、轻量级的开源 Web 服务器与反向代理服务器以处理高并发、低资源占用、稳定性强而著称是现代互联网架构的核心组件之一2.安装使用2.1安装nginxsudo apt-get update -ysudo apt-get install nginx -y2.2conf配置文件存放地址/etc/nginx/conf.d/8111.conf8111为文件名可自定义server {listen 8111; #监听地址server_name 0.0.0.0;#监听ip地址underscores_in_headers on;#前端打包后的文件访问块location /{root /home/html/test;#前端打包文件地址index index.html;}access_log /var/log/nginx/example.com.access.log;error_log /var/log/nginx/example.com.error.log;}2.3前端文件放置位置位置/home/html/test一般有三个文件assetsindex.htmlvite.svg2.4nginx启动命令# 查看版本号nginx -V# 查看状态sudo systemctl status nginx# 开启sudo systemctl start nginx# 关闭sudo systemctl stop nginx# 重启nginx通常用在更新配置文件而不关闭服务器sudo systemctl restart nginx2.5访问http://本机ip地址:8111