Nginx(1) Linux 快速安装,启动nginx
2016-08-04 23:23
411 查看
nginx是一种高效的支持高并发的轻量级服务器,它还可以用来做反向代理和负载均衡。
Linux配置nginx的步骤如下:
一,到https://nginx.org/en/download.html 页面下载最新的稳定版本的包( 我下的是nginx-1.10.1.tar.gz)并上传至Linux某个目录后解压。
tar -zvxf nginx-1.10.1.tar.gz
然后进入解压后的目录执行./configure
提示错误:
[root@VM_126_4_centos nginx-1.10.1]# ./configure
checking for OS
+ Linux 2.6.32-431.23.3.el6.centos.plus.x86_64 x86_64
checking for C compiler ... not found
./configure: error: C compiler cc is not found 执行 yum install gcc gcc-c++ ncurses-devel perl
提示错误:
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
执行, yum -y install pcre-devel,再次./configure
成功
二,在nginx目录依次执行,make, make install 。
查看/usr/local/文件夹下有没有nginx
[root@dn3 nginx-1.10.1]# ls /usr/local/
agenttools nginx qcloud sa services
有,说明安装成功
三,启动nginx
首先编辑配置文件,将端口修改为8086,vim /usr/local/nginx/conf/nginx.conf
server {
listen 8086;
server_name localhost;
然后启动
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
没反应后,测试
[root@dn3 ~]# curl http://localhost:8086/
<!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>
成功!
tips:
windows 系统下,只需将nginx-1.10.1.zip解压,然后进入解压后的文件夹nginx-1.10.1
双击nginx.exe即可
然后再自己浏览器中访问地址http://localhost/
返回页面如下则表示成功运行nginx
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
Linux配置nginx的步骤如下:
一,到https://nginx.org/en/download.html 页面下载最新的稳定版本的包( 我下的是nginx-1.10.1.tar.gz)并上传至Linux某个目录后解压。
tar -zvxf nginx-1.10.1.tar.gz
然后进入解压后的目录执行./configure
提示错误:
[root@VM_126_4_centos nginx-1.10.1]# ./configure
checking for OS
+ Linux 2.6.32-431.23.3.el6.centos.plus.x86_64 x86_64
checking for C compiler ... not found
./configure: error: C compiler cc is not found 执行 yum install gcc gcc-c++ ncurses-devel perl
提示错误:
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
执行, yum -y install pcre-devel,再次./configure
成功
二,在nginx目录依次执行,make, make install 。
查看/usr/local/文件夹下有没有nginx
[root@dn3 nginx-1.10.1]# ls /usr/local/
agenttools nginx qcloud sa services
有,说明安装成功
三,启动nginx
首先编辑配置文件,将端口修改为8086,vim /usr/local/nginx/conf/nginx.conf
server {
listen 8086;
server_name localhost;
然后启动
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
没反应后,测试
[root@dn3 ~]# curl http://localhost:8086/
<!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>
成功!
tips:
windows 系统下,只需将nginx-1.10.1.zip解压,然后进入解压后的文件夹nginx-1.10.1
双击nginx.exe即可
然后再自己浏览器中访问地址http://localhost/
返回页面如下则表示成功运行nginx
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
相关文章推荐
- linux 安装了memcache模块,phpinfo加载不了 & Nginx和PHP-FPM的启动/重启脚本
- 在Linux里安装、启动nginx
- linux下nginx编译安装启动
- Linux下Nginx安装/启动/重启/停止
- VPS 快速安装 Linux+Nginx+MySQL+PHP 环境
- 夺命雷公狗---linux NO:31 linux下实战安装nginx并启动
- 在Linux里安装、启动nginx
- Linux下载安装Nginx并配置,以及启动/停止/重启命令
- linux(ubuntu16.04)在安装PhpStorm并设置快速启动phpstorm
- linux——编译安装nginx出现报错,以及启动nginx服务时80端口被占用怎么解决?
- linux上nginx的安装启动以及配合php-fpm的使用
- 如何在Linux上安装tomcat并利用脚本快速启动
- linux下快速安装nginx
- 虚拟机Linux系统安装nginx服务器并启动的步骤
- Linux中安装nginx以及启动、关闭和重启命令
- linux(centos6.6) 下安装,配置nginx, 及开机自启动
- 虚拟机Linux系统安装nginx服务器并启动的步骤
- linux下redis快速安装和开机启动
- Nginx的启动、停止与重启 启动 启动代码格式:nginx安装目录地址 -c nginx配置文件地址 例如: [root@LinuxServer sbin]# /usr/local/nginx
- linux上安装nginx,启动及停止