服务器Nginx配置及文件目录

一、安装Nginx

指令

yum install -y nginx

 二、设置开机启动

指令

systemctl start nginx.service
systemctl enable nginx.service

三、浏览器打开ip地址查看效果

四、注意事项

服务器端口号需要提前开放,nginx默认端口号为80

Nginx服务器代码位置为 /usr/share/nginx/html

重启服务器指令 /sbin/nginx -s reload

Linux 的软件安装目录是也是有讲究的,理解这一点,在对系统管理是有益的

/usr:系统级的目录,可以理解为C:/Windows//usr/lib理解为C:/Windows/System32
/usr/local:用户级的程序目录,可以理解为C:/Progrem Files/。用户自己编译的软件默认会安装到这个目录下。
/opt:用户级的程序目录,可以理解为D:/Software,opt有可选的意思,这里可以用于放置第三方大型软件(或游戏),当你不需要时,直接rm -rf掉即可。

在硬盘容量不够时,也可将/opt单独挂载到其他磁盘上使用。

源码放哪里?
/usr/src:系统级的源码目录。
/usr/local/src:用户级的源码目录

原文地址:https://www.cnblogs.com/yad123/p/12881346.html