linux查找nginx安装目录_Linux中如何简单快速安装nginx以及如何配置
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash

·
近年来nginx很受欢迎,简单的来说nginx是一个高性能web服务器,下面是它的安装步骤。
1、安装依赖库
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
2、下载nginx源码包并解压
首先创建一个目录等下安装nginx
mkdir /usr/local/nginx
下载nginx源码
cd /usr/local/nginxwget http://nginx.org/download/nginx-1.14.2.tar.gz tar -zxvf nginx-1.14.2.tar.gz
3、安装nginx
cd nginx-1.14.2./configuremake && make install
基本上没什么意外就安装成功了,一般是缺少什么依赖库会安装失败,如果安装不成功,根据所需要的依赖库下载。
4、配置nginx.conf文件
vim /usr/local/nginx/conf/nginx.confserver { listen 8080; server_name localhost; location / { root html; index index.html index.htm; }}
listen的80端口如果有被其他服务占用,一般被apache占用了,可改为其他端口,例如8080
server_name 改为你现在的IP地址,然后推出保存。
5、启动nginx并查看
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
-c的意思是指定哪个配置文件启动,这条命令意思就是指定/usr/local/nginx/conf/nginx.conf配置文件启动nginx
查看nginx是否启动
ps aux|grep nginx

6、nginx常用命令
nginx -c //指定哪个路径下的配置启动nginxnginx -s reload //重启nginxnginx -s stop //停止关闭nginx
7、访问nginx服务器
在浏览器中输入IP地址和端口

到此就成功安装完成nginx了,后期需要什么功能再添加慢慢完善了。




A beautiful web dashboard for Linux
最近提交(Master分支:5 个月前 )
186a802e
added ecosystem file for PM2 4 年前
5def40a3
Add host customization support for the NodeJS version 4 年前
更多推荐
所有评论(0)