阿里云CentOS 7.3配置nginx1.18.0运行环境
#yum -y install gcc gcc-c++ autoconf automake make
mkdir /root/software
cd /root/software
wget http://nginx.org/download/nginx-1.18.0.tar.gz
tar -zxvf nginx-1.18.0.tar.gz
mv nginx-1.18.0 /usr/local/nginx
cd /usr/local/nginx
yum -y install pcre-devel
yum -y install oprenssl openssl-devel
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
cd /usr/local/nginx
make && make install
mkdir logs
./sbin/nginx
netstat -nutap | grep nginx
查看端口进程
netstat -lnp|grep 8080 #8080请换为你的apache需要的端口
lsof -i:80 #查看端口的pid
kill -9 [PID] #-9 表示强迫进程立即停止
ps -ef | grep nginx
netstat -nutap | grep nginx
开启nginx服务
#systemctl start nginx
#systemctl enable nginx
#到ngin目录下 /usr/local/nginx
# 运行起来试一下
./sbin/nginx
#重启先kill 80端口进程
lsof -i:80 #查看端口的pid
kill -9 [PID] #-9 表示强迫进程立即停止
#过滤端口
ss -lntup|grep 80
vim /usr/local/nginx/conf/nginx.conf
server{
#监听端口
listen 80;
#域名设定,可以有多个
server_name www.blog_test.com;
root /Users/mac/sites/blog/public; # 该项要修改为你准备存放相关网页的路径
location / {
# 定义路径下默认访问的文件名
index index.php;
# 打开目录浏览功能,可以列出整个目录
#autoindex on;
}
#proxy the php scripts to php-fpm
location ~ \.php$ {
# fastcgi配置
include /usr/local/etc/nginx/fastcgi.conf;
# 指定是否传递4xx和5xx错误信息到客户端
fastcgi_intercept_errors on;
# 指定FastCGI服务器监听端口与地址,可以是本机或者其它
fastcgi_pass 127.0.0.1:9000;
}
}
把https的cert私钥密钥
查找文件位置
查找error.log日志。。看看怎么查这个文件在linux下的哪个目录
find / -name error.log
查看mongodb位置
#查看conf位置
find / -name mongodb.conf
源码安装
nginx官方源
http://nginx.org/en/linux_packages.html#RHEL-CentOS
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/7/$basearch/ #7是centos7
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
sudo yum install -y nginx
nginx -V