1. 程式人生 > 其它 >lnmp網站

lnmp網站

防火牆

sed -i '/SELINUX/s/enforcing/permissive/' /etc/selinux/config

setenforce 0

firewalld-cmd --set-default-zone=trusted

******************************************************************************

安裝軟體環境

yum install -y gcc openssl-devel  pcre-devel

tar -xvf nginx-1.12.2.tar.gz

cd nginx-1.21.2

,/configure --with-http_ssl_module  --with-http_stub_status_module

make && make install

yum install -y mariadb mariadb-server mariadb-devel

yum install -y php php-fpm php-mysql

******************************************************************************

開機啟動

/usr/loacal/nginx/sbin/nginx 

echo "/usr/local/nginx/sbin/nginx" >> /etc/rc.local

chmod +x  /etc/rc.local

ss -anpt | grep :80

******************************************************************************

啟動軟體

systemctl enable --now mariadb

systemctl enable --now php-fpm

******************************************************************************

設定動靜分離

vim /usr/local/nginx/conf/nginx.conf

location / {

                     root   html;

                     index  index.php  index.html   index.htm;

}

location / {

                root html;

                fastcgi_pass 127.0.0.1:9000;

                fastcgi_index index.php;

                include fastcgi.conf; 

}

/usr/local/nginx/sbin/nginx -s reload

*****************************************************************************

建立資料庫和資料庫使用者

mysql

create database wordpress character set utf8mb4;

grant all  on wordpress.* to wordpress@"%" identified by "wordpress";

flush privileges;

exit

mysql -uwordpress -pwordpress -h 192.168.2.11 wordpress

*******************************************************************************

複製網站原始碼

yum install -y unzip

unizp wordpress.zip

cd wordpress

tar -xvf wordpress-5.0.3-zh_CN.tar.gz

cp -r wordpress/*  /usr/local/nginx/html/

chown -R apache.apache /usr/local/nginx/html/