Nginx安装全过程
程序员文章站
2022-03-03 23:06:25
...
使用CentOS Linux环境。
1.查看当前系统是否有正在运行的Nginx服务:
[[email protected]]# ps -ef | grep nginx
root 57928 53922 0 16:38 pts/1 00:00:00 grep --color=auto nginx
2.没有,则查看安装包是否存在:
[[email protected]]# rpm -qa nginx*
3.不存在,则下载安装包
我使用网络下载包下载。先下载官网上的压缩包,再压缩,再安装。
[[email protected] opt]# wget http://nginx.org/download/nginx-1.14.2.tar.gz
[[email protected] opt]# tar -zxvf nginx-1.14.2.tar.gz
[[email protected] opt]# cd nginx-1.14.2/
4.使用make安装
[[email protected] ~]# whereis nginx
[[email protected] ~]# ./configure
[[email protected] ~]# make
[[email protected] ~]# make install
5.查看安装目录
[[email protected] ~]# whereis nginx
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz /usr/share/man/man3/nginx.3pm.gz
6.检查nginx配置文件是否正确
[[email protected] ~]# /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
7.启动nginx(启动成功不会输出任何提示信息)
[[email protected] ~]# /usr/local/nginx/sbin/nginx
8.查看nginx是否安装成功
[[email protected] ~]# curl http://127.0.0.1:80
root 58307 1 0 16:57 ? 00:00:00 nginx: master process nginx
nginx 58308 58307 0 16:57 ? 00:00:00 nginx: worker process
root 58850 1 0 17:27 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/ngin.conf
nginx 58851 58850 0 17:27 ? 00:00:00 nginx: worker process
root 58886 53922 0 17:29 pts/1 00:00:00 grep --color=auto nginx
输出nginx首页
[[email protected] nginx-1.14.2]# curl http://127.0.0.1:80
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
推荐阅读
-
电脑安装ABBYY FineReader 12提示访问文件被拒绝的解决方法
-
mysql 5.7以上版本安装配置方法图文教程(mysql 5.7.12mysql 5.7.13mysql 5.7.14)
-
Wing FTP Server FTP服务器端中文版安装使用教程
-
Mysql5.7.17 winx64.zip解压缩版安装配置图文教程
-
ie9无法安装怎么解决?ie9无法安装解决图文教程
-
linux下mysql的安装步骤
-
windows系统mysql5.7.18安装图文教程
-
谷歌浏览器(chrome)的免费插件时空隧道安装与使用图文教程
-
详解在React项目中安装并使用Less(用法总结)
-
python3.4+pycharm 环境安装及使用方法