新LNMP
Nginx 安装
yum install epel-release
yum update yum -y install pcre pcre-devel zlib zlib-devel openssl openssl-devel gcc gcc-c++ autoconf automake make wget http://nginx.org/download/nginx-1.12.2.tar.gz tar -zxvf nginx-1.12.2.tar.gz cd nginx-1.12.2/ ./configure --prefix=/usr/local/nginx make && make install groupadd nginx useradd -M -g nginx -s /sbin/nologin nginx cd /usr/local/nginx/conf vim nginx.conf
添加内容 user nginx nginx;
vim /lib/systemd/system/nginx.service
添加内容如下:
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl restart nginx
systemctl enable nginx.service
查看防火墙状态
systemctl status firewalld
开启80端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
重启防火墙
firewall-cmd --reload
查看开启端口列表
firewall-cmd --list-ports
NGINX 安装完成 打开浏览器测试
PHP安装
cd /usr/local/src/
yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel sqlite-devel oniguruma oniguruma-devel
wget https://www.php.net/distributions/php-8.2.5.tar.gz
tar -zxvf php-8.2.5.tar.gz
cd php-8.2.5
./configure --prefix=/usr/local/php --disable-fileinfo --enable-fpm --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-openssl --with-zlib --with-curl --enable-ftp --with-gd --with-xmlrpc --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-gd-native-ttf --enable-mbstring --with-mcrypt=/usr/local/libmcrypt --enable-zip --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mysql-sock=/var/lib/mysql/mysql.sock --without-pear --enable-bcmath
make && make install
cp php.ini-development /etc/php.ini
cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf
vim php-fpm.conf
cd php-fpm.d/
cp www.conf.default www.conf
vim /usr/local/nginx/conf/nginx.conf
systemctl restart nginx.service
vim /etc/systemd/system/php-fpm.service
内容如下
[Unit]
Description=php-fpm
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/php/sbin/php-fpm
PrivateTmp=True
[Install]
WantedBy=multi-user.target
systemctl enable php-fpm.service
systemctl start php-fpm.service
cd /usr/local/nginx/html/
vim phpinfo.php
cd /usr/local/src/php-8.2.5/
cd ext/pcntl/
ln -s /usr/local/php/bin/php /usr/bin/php
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
echo "extension=pcntl.so" >> /etc/php.ini
systemctl restart php-fpm.service
php -m
安装MySQL
https://www.cnblogs.com/zjj1990/p/16836595.html