Linux安装Nginx的方法
2016-12-11 13:21
453 查看
转自:http://www.codingyun.com/article/42.html
可以先下载到本地,然后ftp到服务器
官方Nginx 的下载页面:
也可以直接在服务器下载(windows版本的区分32位与64位,ubuntu(linux)版本的不区分)
或者可以到我的共享云盘下载
二、准备工作
首先,创建相应的目录
三、解压
我一般都会把文件下载到/root/softDown
因此nginx的tar文件也在这个目录下
当前所在目录/root/softDown/nginx-1.6.1
执行以下命令,命令如果太长,可以换行,换行符为\
如果报错的话,如下的错误:
./configure: error: SSL modules require the OpenSSL library. You can either do not enable the modules, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using --with-openssl=option.
代表依赖的OpenSSL library包还没有安装(上面阿里云提供的sh脚本少了这个library依赖,这里我们自己下载安装)
所以先下载依赖包,执行以下命令,安装该OpenSSL library
如果报错PCRE library没有安装,则下载安装
这样的话缺少的依赖包安装好了,就可以继续安装nginx了
四、编译,安装
make -jn (n = cpu核心x2)的多线程编译的参数
我的服务器是2核的,所以用的是make -j4 (所以你的是x核,那么这里就是make -j2x)
执行安装
五、运行
六、测试验证
安装成功后 /usr/local/www/nginx 目录下有四个子目录分别是:conf、html、logs、sbin 。 其中 Nginx 的配置文件存放于 conf/nginx.conf,Nginx 只有一个程序文件位于 sbin 目录下的 nginx 文件。 确保系统的 80 端口没被其他程序占用,运行 sbin/nginx 命令来启动 Nginx,打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功。
可以先下载到本地,然后ftp到服务器
官方Nginx 的下载页面:
首先,创建相应的目录
我一般都会把文件下载到/root/softDown
因此nginx的tar文件也在这个目录下
执行以下命令,命令如果太长,可以换行,换行符为\
./configure: error: SSL modules require the OpenSSL library. You can either do not enable the modules, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using --with-openssl=option.
代表依赖的OpenSSL library包还没有安装(上面阿里云提供的sh脚本少了这个library依赖,这里我们自己下载安装)
所以先下载依赖包,执行以下命令,安装该OpenSSL library
make -jn (n = cpu核心x2)的多线程编译的参数
我的服务器是2核的,所以用的是make -j4 (所以你的是x核,那么这里就是make -j2x)
安装成功后 /usr/local/www/nginx 目录下有四个子目录分别是:conf、html、logs、sbin 。 其中 Nginx 的配置文件存放于 conf/nginx.conf,Nginx 只有一个程序文件位于 sbin 目录下的 nginx 文件。 确保系统的 80 端口没被其他程序占用,运行 sbin/nginx 命令来启动 Nginx,打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功。
相关文章推荐
- linux下Nginx 0.8.40的安装方法
- Linux 安装nginx 已通过该方法安装
- Linux系统Nginx服务器的安装与配置方法
- Linux下Nginx安装的方法(pcre和openssl)
- linux/ubuntu下安装nginx时./configure后出现几种错误的解决方法
- linux下nginx安装详解及常见问题解决方法
- Linux(CentOS 6.8)系统安装Nginx的方法,简单易用!
- Linux下安装nginx时出现“cp: "conf/koi-win" 与"/usr/local/nginx/conf/koi-win" 为同一文件”的解决方法:
- 虚拟机下Linux安装好Nginx后,宿主机无法访问时处理方法
- linux,nginx下php安装Redis扩展的方法
- nginx在linux操作系统上的安装方法
- 在Linux里安装和启动nginx的方法
- 在linux系统下安装两个nginx的简单方法
- Linux包管理命令与Ubuntu下安装nginx的方法
- Linux(Centos6.5)下安装Nginx服务器的方法
- Linux中Nginx的安装和配置方法
- linux 下安装nginx经常出现 make[2]: Leaving directory `/usr/local/ssl' 或make[2]: Leaving directory `/usr/local/openssl' 找不到的情况解决方法
- Linux Nginx Web环境安装SSL证书后强行指向HTTPS方法
- LINUX通用的软件安装方法
- VPC安装LINUX后花屏的解决方法(我实验过,可以用的)