1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| whereis nginx 查看nginx在哪个位置
http { include mime.types; default_type application/octet-stream;
server { listen 80; server_name codehelps.online; 配置域名
sudo /usr/local/nginx/sbin/nginx -s reload 重启nginx
nginx make install 后,目录在 /usr/local/nginx 下,/usr/local/src是源码
sudo 是 “superuser do” 的缩写,用来 以管理员(root)权限执行命令。在 Linux 或 macOS 系统中,普通用户默认没有权限修改系统文件或启动/停止服务,用 sudo 可以临时提升权限执行操作。
基本用法 sudo <命令>
例如:
编辑系统文件
sudo nano /etc/hosts
nano 是编辑器,修改 /etc/hosts 需要 root 权限,所以前面加 sudo。
安装软件
sudo apt install nginx # Ubuntu/Debian sudo yum install nginx # CentOS/RedHat
重启服务
sudo systemctl restart nginx
|