LNMP = Linux Nginx Mariadb Php
靜態界面:html
解析動態界面 :php
解析靜態界面:Nginx
[root@localhost ~]# yum -y install epel-release
[root@localhost ~]# yum -y install nginx
[root@localhost ~]# yum -y install php php-fpm php-curl php-intl php-mysql
[root@localhost ~]# yum -y install mariadb mariadb-server
[root@~]# systemctl start nginx
[root@ ~]# systemctl start php-fpm
[root@ ~]# systemctl enable nginx //將nginx服務設置爲開機自啓動
[root@ ~]# systemctl enable mariadb //將mysql服務設置爲開機自啓動
[root@ ~]# systemctl enable php-fpm //將php-fpm服務設置爲開機自啓動
[root@localhost ~]# mysqladmin -uroot password 'QianF@123' #設置密碼
mariadb 安裝默認是沒有密碼的
[root@localhost ~]# vim /etc/nginx/nginx.conf
修改nginx的訪問資源
修改結果如下:
location ~ \.php$ { root /farm; //文檔根目錄
fastcgi_pass 127.0.0.1:9000; //指定訪問的地址
fastcgi_index index.php; //指定默認訪問的文件
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;//站點根目錄,取決於 root配置項的值
include fastcgi_params; //此包包含nginx常量的定義 }
三.部署php服務
[root@localhost ~]# vim /etc/php.ini
將short_open_tag = Off 改爲 On
[root@localhost ~]# systemctl restart nginx
[root@localhost ~]# systemctl restart php-fpm
五:產品的上線
1.創建網站發佈目錄
[root@localhost ~]# mkdir /farm 創建默認發佈目錄
2.下載項目包 上傳 (可以留言給我 我給你們發送項目包)
3.解壓
[root@localhost ~]# yum -y install unzip 下載解壓工具
[root@localhost ~]# unzip farm-ucenter1.5.zip 解壓文件
4.將項目移動到網站發佈目錄下
[root@localhost ~]# cp -r upload/* /farm
[root@localhost ~]# chmod 777 /farm -R
六:數據庫導入
[root@localhost ~]# cd /farm/
[root@localhost ~]# mysql -u root -p farm < qqfarm.sql
關閉防火牆
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
七:瀏覽器訪問我們的IP地址,測試網站是否正常運行