您好,登錄后才能下訂單哦!
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
待補(bǔ)充
.../sbin/nginx
待補(bǔ)充
1、nginx -t,最為簡單的排錯(cuò),檢查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(這個(gè)文件是你在my.cnf文件中定義的“l(fā)og-error選項(xiàng)”)
cat log/mysql_error.log | grep password
修改MySQL密碼
bin/mysql_secure_installation
...support-files/mysql.server start # 官方啟動(dòng)腳本
問題一:在執(zhí)行mysqld初始化操作時(shí),報(bào)錯(cuò)信息如下:
bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
解決辦法:安裝libaio
運(yùn)行庫
yum install libaio libaio-devel -y
問題二:在使用MySQL自帶的啟動(dòng)腳本啟動(dòng)MySQL時(shí),報(bào)錯(cuò)信息如下:
Starting MySQL. ERROR! The server quit without updating PID file (/data/wwwroot/mysql/data/blog.blacklinux.cn.pid).
解決辦法:檢查權(quán)限
1、MySQL路徑權(quán)限
chown -R www.www /data/wwwroot/mysql # 此處為你的MySQL目錄
2、檢查my.cnf文件
...
[mysqld]
user = www # 指定MySQL的運(yùn)行用戶
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
復(fù)制PHP的默認(rèn)未生成的配置文件
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選項(xiàng)
mysqli.default_socket = /data/wwwroot/mysql/run/mysql.sock
.../sbin/php-fpm
問題一:啟動(dòng)php-fpm報(bào)錯(cuò),報(bào)錯(cuò)信息如下:
[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()
解決辦法:這是因?yàn)樵创a編譯php時(shí)沒有帶上zlib,所以重新編譯時(shí)帶上zlib即可
以MySQL數(shù)據(jù)庫為例
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 #添加端口,格式為:端口/通訊協(xié)議
--permanent #永久生效,沒有此參數(shù)重啟后失效
重啟防火墻
systemctl restart firewalld.service
賦權(quán)
chmod +x /etc/rc.d/rc.local
在rc.local中添加以下內(nèi)容
/lnmp/nginx/sbin/nginx
/lnmp/mysql/support-files/mysql.server start
/lnmp/php/sbin/php-fpm
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。