国产成人精品18p,天天干成人网,无码专区狠狠躁天天躁,美女脱精光隐私扒开免费观看

LNMP安裝&指南:域名綁定、偽靜態(tài)、自定義404 、

發(fā)布時(shí)間:2022-06-23 10:00 來(lái)源:資源部落 閱讀:166 作者:資源部落 欄目: 經(jīng)驗分享 歡迎投稿:712375056

一、LNMP的安裝

##先要下載,并根據不同系統進(jìn)行安裝:
wget -c http://soft.vpser.net/lnmp/lnmp1.5.tar.gz
tar zxvf lnmp1.5.tar.gz
cd lnmp1.5
./install.sh #開(kāi)始進(jìn)行安裝操作

以上為下載及進(jìn)入安裝過(guò)程,以下為安裝前簡(jiǎn)易設置,切記輸入個(gè)其它域名及牢記mysql密碼:

 ------------------------------------------------------------------------ 
|          LNMP V1.5 for CentOS Linux Server, Written by Licess          |
 ------------------------------------------------------------------------ 
|        A tool to auto-compile & install LNMP/LNMPA/LAMP on Linux       |
 ------------------------------------------------------------------------ 
|           For more information please visit https://lnmp.org           |
 ------------------------------------------------------------------------ 
You have 10 options for your DataBase install.
1: Install MySQL 5.1.73
2: Install MySQL 5.5.60 (Default)
3: Install MySQL 5.6.40
4: Install MySQL 5.7.22
5: Install MySQL 8.0.11
6: Install MariaDB 5.5.60
7: Install MariaDB 10.0.35
8: Install MariaDB 10.1.33
9: Install MariaDB 10.2.14
0: DO NOT Install MySQL/MariaDB
Enter your choice (1, 2, 3, 4, 5, 6, 7, 8, 9 or 0): #選擇mysql版本 默認為5.5.60
No input,You will install MySQL 5.5.60
===========================
Please setup root password of MySQL.
Please enter: vpsmm.com #輸入mysql的密碼
===========================
Do you want to enable or disable the InnoDB Storage Engine?
Default enable,Enter your choice [Y/n]: n #是否安裝InnoDB環(huán)境 默認不需要 whmcs之類(lèi)特殊程序需求
You will disable the InnoDB Storage Engine!
===========================
You have 8 options for your PHP install.
1: Install PHP 5.2.17
2: Install PHP 5.3.29
3: Install PHP 5.4.45
4: Install PHP 5.5.38
5: Install PHP 5.6.36 (Default)
6: Install PHP 7.0.30
7: Install PHP 7.1.18
8: Install PHP 7.2.6
Enter your choice (1, 2, 3, 4, 5, 6, 7 or 8): 8 #默認php版本 這里選擇最新
You will install PHP 7.2.6
===========================
You have 3 options for your Memory Allocator install.
1: Don't install Memory Allocator. (Default)
2: Install Jemalloc
3: Install TCMalloc
Enter your choice (1, 2 or 3): 1 這個(gè)默認選擇不安裝即可
You will install not install Memory Allocator.
#按任意鍵,設置完成,正式進(jìn)入安裝,預計20-40分鐘完成

常見(jiàn)lnmp管理命令:

#1.2版本以后,不需要再執行/root/lnmp了,可以在任意位置執行lnmp命令
lnmp #會(huì )出現一些提示信息
lnmp restart #重啟
lnmp vhost add #添加網(wǎng)站綁定
lnmp database add #添加數據信息

二,域名綁定詳解

其實(shí)所謂的域名綁定,就是通過(guò)命令的形式,簡(jiǎn)易創(chuàng )建一個(gè)conf文件到/usr/local/nginx/conf/vhost下面,這個(gè)過(guò)程完全可以手工創(chuàng )建conf,或者,平時(shí)修改目錄、域名等,直接修改conf文件,效果完全一樣:

lnmp vhost add #執行lnmp添加網(wǎng)站命令
 ------------------------------------------- 
|    Manager for LNMP, Written by Licess    |
 ------------------------------------------- 
Please enter domain(example: www.lnmp.org): vpsmm.com #輸入綁定的主域名
======================================
 Your domain: vpsmm.com
======================================
Do you want to add more domain name? (y/n) y #是否綁定其它域名
Enter domain name(example: lnmp.org *.lnmp.org): www.vpsmm.com #輸入其它域名
domain list: www.vpsmm.com
Please enter the directory for the domain: vpsmm.com
(Default directory: /home/wwwroot/vpsmm.com): #默認創(chuàng  )建的網(wǎng)站文件所在目錄
Virtual Host Directory: /home/wwwroot/vpsmm.com
===========================
Allow Rewrite rule? (y/n)
===========================
y #是否添加偽靜態(tài)文件
Please enter the rewrite of programme: 
wordpress,discuz,typecho,sablog,dabr rewrite was exist.
(Default rewrite: other):typecho #小夜用的typecho程序
===========================
You choose rewrite=typecho
===========================
===========================
Allow access_log? (y/n)
===========================
n #是否啟用日志文件
======================================================
Create database and MySQL user with same name (y/n)
======================================================
y #是否創(chuàng  )建mysql數據庫
verify your current MySQL root password: **** #輸入安裝時(shí)的mysql數據庫root密碼
Warning: Using a password on the command line interface can be insecure.
MySQL root password correct.
Enter database name: vpsmm_user #創(chuàng  )建數據庫用戶(hù)名
Your will create a database and MySQL user with same name: vpsmm_user
Please enter password for mysql user vpsmm_user: vpsmmpasswd
Your password: vpsmmpasswd #創(chuàng  )建相應密碼

Press any key to start create virtul host...

Create Virtul Host directory......
set permissions of Virtual Host directory......
You select the exist rewrite rule:/usr/local/nginx/conf/typecho.conf
Gracefully shutting down php-fpm . done
Starting php-fpm  done
Test Nginx configure file......
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

Restart Nginx......
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
User vpsmm_user create Sucessfully.
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
Database: vpsmm_user create Sucessfully.
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
GRANT ALL PRIVILEGES ON vpsmm_user Sucessfully.
Warning: Using a password on the command line interface can be insecure.
FLUSH PRIVILEGES Sucessfully.
================================================
Virtualhost infomation:
Your domain: vpsmm.com
Home Directory: /home/wwwroot/vpsmm.com
Rewrite: typecho
Enable log: no
Database username: vpsmm_user
Database userpassword: vpsmmpasswd
Database Name: vpsmm_user
Create ftp account: no
#以上為新創(chuàng  )建網(wǎng)站的一些信息
================================================

三、自定義偽靜態(tài)規則

如果lnmp默認的偽靜態(tài)規則不能滿(mǎn)足你的需要,或者,你要自行定義偽靜態(tài)規則,可以新建一個(gè)conf文件,放置于 /usr/local/nginx/conf 下,在域名配置文件,即:/usr/local/nginx/conf/vhost/legcloud.com.conf 里引用。

server
  {
    listen       80;
    server_name legcloud.com www.legcloud.com; #綁定的域名
    index index.html index.htm index.php default.html default.htm default.php; #首頁(yè)文件
    root  /home/legcloud.com; #網(wǎng)站存放目錄
    include wordpress.conf; #偽靜態(tài)規則文件,可自定義成你需要的
    location ~ .*.(php|php5)?$
      {
        try_files $uri =404;
        fastcgi_pass  unix:/tmp/php-cgi.sock;
        fastcgi_index index.php;
        include fcgi.conf;
      }
    location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
      {
        expires      30d;
      }
    location ~ .*.(js|css)?$
      {
        expires      12h;
      }
    access_log off;
  }

修改設置以后,一定要重新載入lnmp或者,重新載入nginx,以下任決命令都一樣:

/root/lnmp reload #使用lnmp重新載入配置
/etc/init.d/nginx reload #只重新載入nginx配置,我一般用這個(gè)

四、自定義404、503等常見(jiàn)錯誤

不管是404還是503等常見(jiàn)錯誤,還是設置/usr/local/nginx/conf/vhost/legcloud.com.conf文件來(lái)完成:

   listen       80;
    server_name legcloud.com www.legcloud.com;
    index index.html index.htm index.php default.html default.htm default.php;
    root  /home/legcloud.com;
    error_page 404 /404.php; #放在這里,可自定義文件名,再重載nginx就可以了
    include wordpress.conf;

五、判斷當前域名并自動(dòng)301到主域名

if ($host != 'vpsmm.com' ) {rewrite ^/(.*)$ http://www.vpsmm.com/$1 permanent;}
#判斷當前域名,如果不是則自動(dòng)301到主域名,放置于error_page ...;上下均可。

六、關(guān)閉或開(kāi)啟FSO等php函數

lnmp最新版,默認禁用了一些函數,例如fso等,可修改/usr/local/php/etc/php.ini

disable_functions = passthru,exec,system,chroot,scandir....
#----這是禁用函數,把不想禁用的刪除即可----如果自用主機,最簡(jiǎn)單的修改方案:
disable_functions =
; passthru,exec,system,chroot,scandir....
#----設置為全部開(kāi)啟

修改后,使用/etc/init.d/php-fpm restart,重新啟動(dòng)php

七、升級PHP和NGINX版本

cd lnm0.9 #進(jìn)入lnmp安裝目錄
./upgrade_nginx.sh #升級nginx,只要輸入你要升級的版本即可(可見(jiàn)nginx.org)
./upgrade_php.sh #升級php,只要輸入你要升級的版本即可(可見(jiàn)php.net)

來(lái)源鏈接:https://www.zyhot.com/article/844.html

本站聲明:網(wǎng)站內容來(lái)源于網(wǎng)絡(luò ),如有侵權,請聯(lián)系我們,我們將及時(shí)處理。

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng )、來(lái)自本網(wǎng)站內容采集于網(wǎng)絡(luò )互聯(lián)網(wǎng)轉載等其它媒體和分享為主,內容觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如侵犯了原作者的版權,請告知一經(jīng)查實(shí),將立刻刪除涉嫌侵權內容,聯(lián)系我們QQ:712375056,同時(shí)歡迎投稿傳遞力量。

国产老肥熟xxxx| 军人野外吮她的花蒂无码视频| 亚洲国产成人精品无码区在线网站| 野花日本大全免费观看10中文| 国产欧美久久一区二区三区| 97精品人妻系列无码人妻|