您好,登录后才能下订单哦!
yum install -y wget vim gcc gcc-c++ zlib-devel pcre-devel openssl-devel
./configure --with-http_stub_status_module --prefix=/data/wwwroot/nginx-1.17.1 --user=www --group=www --with-http_ssl_module
待补充
.../sbin/nginx
待补充
1、nginx -t,最为简单的排错,检查nginx的配置文件语法,若无问题,则返回类似下面这样的消息
nginx: the configuration file /data/wwwroot/nginx-1.17.1/conf/nginx.conf syntax is ok
nginx: configuration file /data/wwwroot/nginx-1.17.1/conf/nginx.conf test is successful
2、打开nginx的日志功能
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
将前面的“#”去掉即可
bin/mysqld --initialize --user=www --basedir=/data/wwwroot/mysql --datadir=/data/wwwroot/mysql/data
初始化后的密码保存在log文件下的mysql_error.log(这个文件是你在my.cnf文件中定义的“log-error选项”)
cat log/mysql_error.log | grep password
修改MySQL密码
bin/mysql_secure_installation
...support-files/mysql.server start # 官方启动脚本
问题一:在执行mysqld初始化操作时,报错信息如下:
bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
解决办法:安装libaio
运行库
yum install libaio libaio-devel -y
问题二:在使用MySQL自带的启动脚本启动MySQL时,报错信息如下:
Starting MySQL. ERROR! The server quit without updating PID file (/data/wwwroot/mysql/data/blog.blacklinux.cn.pid).
解决办法:检查权限
1、MySQL路径权限
chown -R www.www /data/wwwroot/mysql # 此处为你的MySQL目录
2、检查my.cnf文件
...
[mysqld]
user = www # 指定MySQL的运行用户
port = 3306
...
yum install -y zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel
./configure --prefix=/data/wwwroot/php-7.3.7 --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-zlib --with-openssl
使用PHP源码包自带的配置文件
mv lib/php.ini-production lib/php.ini
复制PHP的默认未生成的配置文件
cp -a etc/php-fpm.conf.default etc/php-fpm.conf
cp -a etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
修改php.ini中的mysqli.default_socket选项
mysqli.default_socket = /data/wwwroot/mysql/run/mysql.sock
.../sbin/php-fpm
问题一:启动php-fpm报错,报错信息如下:
[root@localhost php-7.3.7]# sbin/php-fpm
[05-Jul-2019 04:01:01] WARNING: Nothing matches the include pattern '/lnmp/php-7.3.7/etc/php-fpm.d/*.conf' from /lnmp/php-7.3.7/etc/php-fpm.conf at line 143.
[05-Jul-2019 04:01:01] ERROR: No pool defined. at least one pool section must be specified in config file
[05-Jul-2019 04:01:01] ERROR: failed to post process the configuration
[05-Jul-2019 04:01:01] ERROR: FPM initialization failed
解决办法:生成www.conf
cp -a etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
问题二:Fatal error: Uncaught Error: Call to undefined function gzinflate()
解决办法:这是因为源码编译php时没有带上zlib,所以重新编译时带上zlib即可
以MySQL数据库为例
create database wordpress;
grant all on wordpress.* to wordpress@'localhost' identified by '123456';
flush privileges;
添加80(http)和443(https)端口对外开放
firewall-cmd --zone=public --add-port=80/tcp --permanent
命令含义:
--zone #作用域
--add-port=80/tcp #添加端口,格式为:端口/通讯协议
--permanent #永久生效,没有此参数重启后失效
重启防火墙
systemctl restart firewalld.service
赋权
chmod +x /etc/rc.d/rc.local
在rc.local中添加以下内容
/lnmp/nginx/sbin/nginx
/lnmp/mysql/support-files/mysql.server start
/lnmp/php/sbin/php-fpm
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。