CentOS安装Nginx
CentOS安装Nginx
1.安装Nginx前的准备
yum -y install gcc automake autoconf libtool make
yum install gcc gcc-c++
2.下载Nginx和其组件
cd /usr/local/src
- 安装openssl
wget http://www.openssl.org/source/openssl-fips-2.0.16.tar.gz
tar -zxvf openssl-fips-2.0.16.tar.gz
cd openssl-fips-2.0.16
./configure && make && make install
- 安装pcre
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.42.tar.gz
tar -zxvf pcre-8.42.tar.gz
cd pcre-8.42
./configure && make && make install
- 安装zlib
yum -y install openssl openssl-devel
yum -y install pcre pcre-devel
yum -y install zlib zlib-devel
- 安装nginx
wget http://nginx.org/download/nginx-1.15.0.tar.gz
tar -zxvf nginx-1.15.0.tar.gz
cd nginx-1.15.0
./configure && make && make install
3.启动nginx
cd /usr/local/nginx/sbin/(进入nginx安装目录)
./nginx
4.修改nginx配置文件
vi /usr/local/nginx/conf/nginx.conf
- 添加域名指向服务器,并且修改第一个server为以下配置:
server {
listen 80;
server_name coder7911.club;
location / {
proxy_pass http://127.0.0.1:8080;
}
}
5.nginx常用相关命令
./nginx
./nginx -t
./nginx -s relaod
ps -ef|grep nginx
kill -9 进程号
tail -f /usr/local/nginx/logs/access.log
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »