tar zxvf mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.6.43-linux-glibc2.12-x86_64 /usr/local/mysql
useradd -s /sbin/nologin mysql
cd /usr/local/mysql/
mkdir -p /data/mysql
chown -r mysql:mysql /data/mysql/
yum install -y perl perl-devel
yum install -y perl-data-dumper
./scripts/mysql_install_db --datadir=/data/mysql/ --user=mysql
cp support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
vim /etc/init.d/mysqld
查詢 datadir 修改為 datadir=/data/mysql
把啟動指令碼加入系統服務項,設定開機啟動
chkconfig --add mysqld
chkconfig mysqld on
啟動mysql
service mysqld start
檢視mysql是否啟動
ps aux | grep mysqld
做個鏈結可以用mysql -uroot -p
ln -s /usr/local/mysql/bin/mysql /usr/bin
cd /usr/local/src/
tar zxf php-7.3.4.tar.gz
useradd -s /sbin/nologin php-fpm
cd php-7.3.4
yum install -y libcurl-devel
yum install -y libevent gcc libxml2-devel openssl openssl-devel libjpeg-devel libpng libpng-devel freetype-devel
./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-pear --with-curl --with-openssl
make && make install
修改配置檔案
cp php.ini-production /usr/local/php-fpm/etc/php.ini
vim /usr/local/php-fpm/etc/php-fpm.conf
把以下內容寫到該檔案
[global]
pid = /usr/local/php-fpm/var/run/php-fpm.pid
error_log = /usr/local/php-fpm/var/log/php-fpm.log
[www]
listen = /tmp/php-fcgi.sock
listen.mode = 666
user = php-fpm
group = php-fpm
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files =1024
儲存退出並檢視是否正確(顯示test is successful就ok了)
/usr/local/php-fpm/sbin/php-fpm -t
啟動php-fpm
cp /usr/local/src/php-7.3.4/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm
useradd -s /sbin/nologin php-fpm
service php-fpm start
設定開機啟動、檢查是否啟動
chkconfig php-fpm on
ps aux | grep php-fpm
cd /usr/local/src/
tar zxvf nginx-1.14.2.tar.gz
cd nginx-1.14.2
./configure --prefix=/usr/local/nginx
make && make install
編寫nginx啟動指令碼,加入系統服務
vim /etc/init.d/nginx
#新增以下**
exit $retval
儲存指令碼並更改許可權、開機自啟
chmod 755 /etc/init.d/nginx
chkconfig --add nginx
chkconfig nginx on
更該nginx的配置檔案
> /usr/local/nginx/conf/nginx.conf
vim /usr/local/nginx/conf/nginx.conf
#新增以下**
}}
檢查配置檔案有沒有錯誤,出現ok、successful就說明是正確的
/usr/local/nginx/sbin/nginx -t
啟動nginx(若不能啟動,檢視/usr/local/nginx/logs/error.log)
service nginx start
測試是否能解析php
vim /usr/local/nginx/html/index.php
#新增以下內容
<?php
echo "test php ok";
?>
執行測試命令
curl localhost/index.php
centos7 4 原始碼搭建LNMP
編輯配置檔案 測試 重啟 驗證 結果 2.1 訪問的目錄 data nginx test.com admin 編輯配置檔案 vim usr local nginx conf vhost test.com.conf 新增以下 location admin 這是拒絕某個ip訪問 usr local ng...
centos7 4 原始碼安裝 nginx
安裝所需要環境 yum install gcc c pcre pcre devel 安裝 pcre perl compatible regular expressions 是乙個perl庫,包括 perl 相容的正規表示式庫。nginx 的 http 模組使用 pcre 來解析正規表示式,所以需要在...
Centos 7 4 原始碼 Nginx 安裝
yum y install make zlib zlib devel gcc c libtool openssl openssl devel pcre 作用是讓 nginx 支援 rewrite 功能。root bogon src wget 2 解壓安裝包 root bogon src tar zx...