WinNMP(WTserver)安裝設定教學 (Nginx)

WinNMP(WTserver)安裝設定教學 (Nginx)

先介紹一下WinNMP以前是叫WTserver。

如何設定 MariaDB root 密碼?

In order to set mysql(mariadb)

1
root

password, open a command prompt and type

1
C:\WinNMP\bin\MySql\bin\mysqladmin -u root password NEWPASSWORD

重啟WTserver

 

Nginx出現413 Request Entity Too Large

編輯 nginx.conf

client_max_body_size 50m;

 

 

使用WP一些建議的設定

編輯 php.ini

post_max_size = 30M
max_execution_time = 300
max_input_time = 150
memory_limit = 256M
upload_max_filesize = 30M
max_file_uploads = 100

 

How to allow access from LAN and Internet to your local project

編輯 projectName.conf

server {
listen 127.0.0.1:80;
listen *:80;

server_name projectName.test projectName.com projectName.myDomain.com;

### Access Restrictions
allow all;
## deny all;

 

How to set expires headers

編輯 projectName.conf

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 30d;
log_not_found off;
}

 

enable exec()

編輯 php.ini

找到 disable_functions

把exec拿掉

 

解決 Nginx 下修改 WordPress 固定連結後導致文章跳出404

在站台的conf檔,在Server{}中加入以下程式碼:

1
2
3
4
5
6
7
8
9
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}

 

開啟Gzip

編輯 nginx.conf

gzip on;
gzip_min_length  1100;
gzip_buffers  4 32k;
gzip_types    text/plain application/x-javascript text/xml text/css;
gzip_vary on;

 

成功的話,網站首頁如下圖:

WinNMP(WTserver)安裝設定教學 (Nginx)
WinNMP(WTserver)安裝設定教學 (Nginx)

WinNMP(WTserver)安裝設定教學 (Nginx)

WinNMP如何升級

建議還是先做好備份
請直接下載最新的安裝檔,執行安裝
在升級過程中,所有原本的數據庫、設置、都會保留。

HTTP強制重定向至HTTPS

編輯站台的conf檔

1
2
3
4
5
6
7
8
9
server
{ listen 80;
...
return 301 https://$server_name$request_uri;
}
server
 { listen 443;
...
}
關於作者 多力哥
WinNMP(WTserver)安裝設定教學 (Nginx)
影像創作攝影師/網頁動畫設計師/系統網路工程師/水草研究生
景文科大畢業後,我成為一名網站動畫設計師,並副修MIS電腦資訊管理。2004年,我開始接觸單眼相機,並在2008年正式成為一名接案攝影師,目前使用Canon系統進行拍攝。2016年,我愛上了美麗的水草缸,這讓我的生活多了另一層次的放鬆。每天在電腦前修圖時,能欣賞紅吱吱、綠油油的水草,彷彿多了一份平靜與愉悅。攝影與水草讓我的生活充滿了藝術與自然的交融。
連絡信箱:hello@hahasmile.com (歡迎合作提案)
DORIGO IMAGE 攝影工作室:https://dorigo-image.com
如果你喜歡我的內容,可以用行動贊助我一杯咖啡☕,支持我持續創作,也讓這個網站可以繼續營運下去喔!

若您喜歡這篇文章,歡迎按讚分享喔!
0 回復

發表評論

想要留言嗎?
歡迎歡迎!

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *