nginx
1、解压 nginx:
tar zxf nginx-1.16.0.tar.gz
2、进入 nginx 解压包:
cd nginx-1.16.1
vim src/core/nginx.h
修改: #define NGINX_VER "nginx/"(将此行末尾显示 nginx 版本号的配置删除)
vim auto/cc/gcc
修改:
#debug
#CFLAGS="$CFLAGS -g" #(将这 2 行注释调,关闭 debug),nginx会变小
3、编译 nginx:
./configure --prefix=/usr/local/lnmp/nginx --with-http_ssl_module --with-http_stub_status_module --user=nginx --group=nginx
根据提示解决依赖性 ##此处应该还需要安装 pcre-devel
4、安装
make && make install
5、修改 nginx 配置文件,开启 php 模块
2 user nginx;
43 location / {
44 root html;
45 index index.php index.html index.htm;
46 }
69 location ~ .php$ {
70 root html;
71 fastcgi_pass 127.0.0.1:9000;
72 fastcgi_index index.php;
73 #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
74 include fastcgi.conf;
75 }
6、将 nginx 启动脚本链接到/usr/local/sbin/
ln -s /usr/local/lnmp/nginx/sbin/nginx /usr/local/sbin/
nginx -t ##检测语法
nginx ##开启 nginx
7、尝试访问:http://172.25.1.1
在 nginx 默认发布目录添加 index.php
<?php phpinfo() ?> #可以看到 php 的默认页面8、启动 nginx 并访问:http://172.25.0.1
出现下面错误时:
重启/usr/local/lnmp/php/sbin/php-fpm。
nginx 安装配置完
二、论坛的搭建
mysql -predhat
create database wordpress; #建立数据库
cd /usr/local/lnmp/nginx/html/
chown nginx.nginx wordpress -R #访问
版权声明:本文为YiSean96原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。