nginx搭建web服务器(在线安装)

穿精又带淫゛_ 提交于 2020-01-06 18:52:03

【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>

1、安装包

nginx-1.3.16.tar.gz

2、安装openssl-devel

[root@iZuf6b5mgd99paw7t3hgeiZ]# yum -y install openssl openssl-devel

执行成功之后再执行

./configure

Configuration summary 
+ using system PCRE library 
+ using system OpenSSL library 
+ md5: using OpenSSL library 
+ sha1: using OpenSSL library 
+ using system zlib library 
+ jemalloc library is disabled 
nginx path prefix: “/usr/local/nginx” 
nginx binary file: “/usr/local/nginx/sbin/nginx” 
nginx configuration prefix: “/usr/local/nginx/conf” 
nginx configuration file: “/usr/local/nginx/conf/nginx.conf” 
nginx pid file: “/usr/local/nginx/logs/nginx.pid” 
nginx error log file: “/usr/local/nginx/logs/error.log” 
nginx http access log file: “/usr/local/nginx/logs/access.log” 
nginx http client request body temporary files: “client_body_temp” 
nginx dso module path: “/usr/local/nginx/modules/” 
nginx http proxy temporary files: “proxy_temp” 
nginx http fastcgi temporary files: “fastcgi_temp” 
nginx http uwsgi temporary files: “uwsgi_temp” 
nginx http scgi temporary files: “scgi_temp”

看到最后这样的输出,就是配置成功了。 

3、安装pcre-devel

[root@iZuf6b5mgd99paw7t3hgeiZ]# yum install pcre-devel

4、建立nginx用户

[root@iZuf6b5mgd99paw7t3hgeiZ]# groupadd -r nginx

[root@iZuf6b5mgd99paw7t3hgeiZ]# useradd -r -g nginx -M nginx

5、解压缩nginx的源码并安装

[root@iZuf6b5mgd99paw7t3hgeiZ]# tar -zxvf nginx-1.3.16.tar.gz -C /usr/local/src/

[root@iZuf6b5mgd99paw7t3hgeiZ]# cd /usr/local/src/nginx-1.3.16/

[root@iZuf6b5mgd99paw7t3hgeiZ]# make && make install

[root@iZuf6b5mgd99paw7t3hgeiZ]# mkdir -p /var/tmp/nginx/client

6、启动nginx服务并在客户端做测试

# /usr/local/nginx/sbin/nginx

7、浏览器输入http://IP地址 试试

8、nginx常用命令

-- 查看nginx进程

ps -ef|grep nginx

-- 杀死nginx进程

pkill nginx

9、最后云服务器别忘记开放端口号(默认80)

 

参考:

# ./configure \

--conf-path=/etc/nginx/nginx.conf \

--error-log-path=/var/log/nginx/error.log \

--http-log-path=/var/log/nginx/access.log \

--pid-path=/var/run/nginx/nginx.pid \

--lock-path=/var/lock/nginx.lock \

--user=nginx \

--group=nginx \

--with-http_ssl_module \

--with-http_flv_module \

--with-http_stub_status_module \

--with-http_gzip_static_module \

--http-client-body-temp-path=/var/tmp/nginx/client/ \

--http-proxy-temp-path=/var/tmp/nginx/proxy/ \

--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \

--with-pcre

 

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!