實現基於LNMP的小米電子商務網站平台

來源:互聯網
上載者:User

標籤:基於lnmp實現電子商務網站平台

1.環境準備:(安裝後最好檢查一遍是否全部安裝成功)

    yum install nginx php php-mysql php-fpm mariadb mariadb-server

2.路徑建立:mkdir -p /data/web 

3.進入/data/web目錄:cd /data/web

4.上傳模板包:rz xiaomi.zip

5.解壓模板包:unzip -d . xiaomi.zip

(unzip -d /data/web xiaomi.zip  -d指定解壓到哪個目錄 “.”表示目前的目錄)

6.修改/data/web目錄許可權:chown -R nodoby.nobody .

650) this.width=650;" src="https://s1.51cto.com/oss/201711/04/fb7365e27aeda6e4cb0555a2bfe61ce7.png" title="4.png" alt="fb7365e27aeda6e4cb0555a2bfe61ce7.png" />

7.修改nginx的設定檔:

    cd /etc/nginx

    cp nginx.conf.default nginx.conf

    vim nginx.conf

650) this.width=650;" src="https://s2.51cto.com/oss/201711/04/ac844933a06bba8ecaf042873e455363.png" title="5.png" alt="ac844933a06bba8ecaf042873e455363.png" />

http模組內:

650) this.width=650;" src="https://s4.51cto.com/oss/201711/04/3cf8cac34fad3b4c55a0ba534b808d29.png" title="6.png" alt="3cf8cac34fad3b4c55a0ba534b808d29.png" />

server模組內:

    修改server_name=xiaomi.com;

    添加預設工作路徑:root /data/web

650) this.width=650;" src="https://s4.51cto.com/oss/201711/04/b96c5f63d64837ddc515bbe90b3c3362.png" title="7.png" alt="b96c5f63d64837ddc515bbe90b3c3362.png" />

啟用location模組:

650) this.width=650;" src="https://s2.51cto.com/oss/201711/04/f2132535412ed70948423e84fdb79732.png" title="8.png" alt="f2132535412ed70948423e84fdb79732.png" />

修改php擴充解析檔案路徑:                      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

(註:root  html;這一項注釋掉或者刪掉,如果啟用,在後面的實驗中,它會變成預設路徑,那麼自己指定的路徑就不會被執行,相應的就找不到頁面,出現file not found,許可權不足或是資料庫無法串連也會出現file not found)

儲存退出。

8.檢查文法有無錯誤:nginx -t 

9.啟動nginx服務:systemctl start nginx

10.修改php.ini檔案:vim /etc/php-fpm.conf

   添加時鐘配置:date.timezone = Asia/Shanghai(設定不設定可以根據你的心情)

   設定short_open_tag=on

650) this.width=650;" src="https://s3.51cto.com/oss/201711/04/f0fc7dcb8ad26eac213e6841cb301608.png" title="9.png" alt="f0fc7dcb8ad26eac213e6841cb301608.png" />

650) this.width=650;" src="https://s2.51cto.com/oss/201711/04/cedfe1b44e631de3eb7042dec0d6aac8.png" title="10.png" alt="cedfe1b44e631de3eb7042dec0d6aac8.png" />

11.啟動php-fpm服務:systemctl start php-fpm

12.啟動mariadb服務:systemctl start mariadb

13.建立資料庫:mysql -uroot

650) this.width=650;" src="https://s1.51cto.com/oss/201711/04/2d03fe3bd7a04dea122763a3b3dac41a.png" title="13.png" alt="2d03fe3bd7a04dea122763a3b3dac41a.png" />

14.修改資料庫設定檔:vim /data/web/data/config.php

650) this.width=650;" src="https://s1.51cto.com/oss/201711/04/ab42eae205461bd027c8f3b62812449a.png" title="15.png" alt="ab42eae205461bd027c8f3b62812449a.png" />

15.修改使用者和組的許可權:vim /etc/php-fpm.d/www.conf

650) this.width=650;" src="https://s3.51cto.com/oss/201711/04/cb431c916646bd053787c8394a41e991.png" title="16.png" alt="cb431c916646bd053787c8394a41e991.png" />

16.重啟php-fpm服務:systemctl restart php-fpm

17.進入ebak檔案下:cd /data/web/ebak/

18.瀏覽器端訪問:

650) this.width=650;" src="https://s1.51cto.com/oss/201711/04/1179ef0b74cc3496aa9d6992ce54db89.png" title="11.png" alt="1179ef0b74cc3496aa9d6992ce54db89.png" />

                使用者名稱:admin  密碼:123456進入

650) this.width=650;" src="https://s5.51cto.com/oss/201711/04/977c9c9770ebf5ef6b853cd572583027.png" title="12.png" alt="977c9c9770ebf5ef6b853cd572583027.png" />

參數設定:

650) this.width=650;" src="https://s4.51cto.com/oss/201711/04/14e632b60f1716487672a7781d8233f3.png" title="14.png" alt="14e632b60f1716487672a7781d8233f3.png" />

(註:資料庫連接不上的原因:①防火牆是否關閉②selinux的配置③資料庫服務是否啟動④修改資料庫設定檔⑤使用者的存取權限(注意查看錯誤記錄檔,根據錯誤提示修改目錄許可權和修改其他錯誤))

恢複資料:

650) this.width=650;" src="https://s3.51cto.com/oss/201711/04/00ba1181b3e838084ffbcd6816f3d9d3.png" title="17.png" alt="00ba1181b3e838084ffbcd6816f3d9d3.png" />

19.後台登入的實現:訪問http://192.168.46.130/admin/index.php

650) this.width=650;" src="https://s3.51cto.com/oss/201711/04/423ce02ffea33e912120d3316c6b863c.png" title="19.png" alt="423ce02ffea33e912120d3316c6b863c.png" />

管理員登入後的頁面:

650) this.width=650;" src="https://s4.51cto.com/oss/201711/04/742cb51ed45e31c8cd795d7d22505e70.png" title="20.png" alt="742cb51ed45e31c8cd795d7d22505e70.png" />

系統設定—>商店設定:

650) this.width=650;" src="https://s5.51cto.com/oss/201711/04/7bdec7ab92f1b763c8e8bb961060af49.png" title="21.png" alt="7bdec7ab92f1b763c8e8bb961060af49.png" />

最後的:(因為這裡只是樣本,所以效果比較簡陋,能看懂就好650) this.width=650;" src="http://img.baidu.com/hi/jx2/j_0011.gif" alt="j_0011.gif" />)

650) this.width=650;" src="https://s4.51cto.com/oss/201711/04/715f0f1fff2015a8a250684b5cbffe9a.png" style="float:none;" title="22.png" alt="715f0f1fff2015a8a250684b5cbffe9a.png" />





本文出自 “Mylog” 部落格,請務必保留此出處http://600600880.blog.51cto.com/13303875/1979027

實現基於LNMP的小米電子商務網站平台

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.