nginx 安装,nginx
nginx 安装,nginx
yum install glib2-devel openssl-devel pcre-devel bzip2-devel gzip-devel gcc gcc-c++ ncurses-devel perl gcc gcc-c++ ncurses-devel perl perl-devel perl-ExtUtils-Embed cd /tmp wget http://nginx.org/download/nginx-1.4.7.tar.gz tar -zxvf nginx-1.4.7.tar.gz cd nginx-1.4.7 ./configure \ --user=nginx\ --group=nginx \ --prefix=/usr/local/nginx \ --with-http_ssl_module \ --with-http_realip_module \ --with-http_addition_module \ --with-http_sub_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_gzip_static_module \ --with-http_stub_status_module \ --with-http_perl_module \ --with-mail \ --with-mail_ssl_module make make install
启动nginx
/usr/local/nginx/sbin/nginx
访问http://localhost,如出现欢迎页面,代表安装成功
在linux下安装nginx的时候,一般在./configure的阶段会要求通过prefix设置安装路径。因此,在./configure的时候指定不同的prefix就可以安装多个nginx啦。
值得注意的是,安装完之后,两个nginx的监听端口要设置成不同的监听端口。否则,会有一个nginx无法启动。
./configure --prefix=/home/work/nginx1 .....//第一个nginx的安装配置make && make install./configure --prefix=/home/work/nginx2 .....//第二个nginx的安装配置make && make installcd /home/work/nginx1/conf/nginx.conf && 修改第一个nginx的监听端口../home/work/nginx1/sbin/nginxcd /home/work/nginx2/conf/nginx.conf && 修改第二个nginx的监听端口../home/work/nginx2/sbin/nginx
这种方式还真没搞过,不过我们可以分析一下。
云平台的特点是数据分布式存储已经数据冗余,可以获取数据,但是却不知道数据具体是怎么存储的,也不知道具体的路径是什么?以hadoop为例,数据都是以元文件的实行存储,并且都是已经切分过的。
但是作为一个webserver,nginx在安装的时候需要指定安装路径等的一系列路径,因此从这一点上讲,nginx是不能作为一个app应用安装在云平台上的。原因就是,如果可以,那么平台就会对外暴露目录结构,这对云平台而言,是不被允许的。
但是,可以用nginx作为代理服务器,或者负载均衡服务器去处理云平台上的应用。
评论暂时关闭