# 可以选择自己安装包放置的路径 cd /usr/local/www/ wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz # 解压压缩包 tar zxvf pcre-8.35.tar.gz # 进入解压目录 cd pcre-8.35/ ./configure # 安装 make && make install # 查看 pcre 版本 pcre-config --version
Nginx 安装、启动
bash
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
cd /usr/local/www/ #创建nginx安装目录 mkdir nginx cd /usr/local/www/ #解压 tar zxvf nginx-1.22.0.tar.gz #进入解压文件夹 cd nginx-1.22.0 #简易配置(2选1) ./configure --prefix=/usr/local/www/nginx #指定配置(2选1) ./configure --prefix=/usr/local/www/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/www/pcre-8.35 make && make install # 进入nginx目录 cd /usr/local/www/nginx/sbin/ # 启动 ./nginx
Nginx启动成功
nginx.conf检查
bash
1 2 3 4
[root@XiaoBo ~]# ./nginx -t # 输出以下内容 nginx: the configuration file /tools/nginx/conf/nginx.conf syntax is ok nginx: configuration file /tools/nginx/conf/nginx.conf test is successful
Nginx设置自启
bash
1 2 3 4
# 进入系统服务脚本目录 cd /usr/lib/systemd/system # 创建ngxin服务相关脚本 touch nginx.service
编辑nginx.service文件 (根据自己安装目录进行修改)
内容如下:
bash
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
[Unit] Description=nginx - web server After=network.target remote-fs.target nss-lookup.target