寶塔面板安裝然之

2019-04-02 10:51 更新

環(huán)境搭建

在寶塔面板中安裝web環(huán)境必要的軟件,包括:

web服務(wù):Apache或Nginx(不建議使用IIS) 本文以nginx為例講解(apache可以參考 源碼安裝的方式部署)。

數(shù)據(jù)庫(kù):Mysql(推薦5.5/5.6)

PHP:PHP 5.4/5.5/5.6/7.0/7.1 都可以(本文以php7.0版本為例介紹如何安裝)

其他軟件工具,根據(jù)自己實(shí)際情況與需要來選擇安裝即可。

添加站點(diǎn)

登錄寶塔面板,在站點(diǎn)管理中點(diǎn)擊“添加站點(diǎn)”。

綁定多個(gè)域名時(shí),每個(gè)域名占一行;

默認(rèn)會(huì)在建站目錄(/www/wwwroot/)下自動(dòng)創(chuàng)建一個(gè)與域名同名的目錄作為網(wǎng)站根目錄;

數(shù)據(jù)庫(kù)選用mysql,并設(shè)置數(shù)據(jù)庫(kù)用戶名和密碼;

PHP選擇   PHP7版本。(本文操作及配置都以PHP7為例)。

上傳文件

注:本文以安裝然之開源版為例進(jìn)行演示,如果您是要安裝然之專業(yè)版,需要先 安裝ioncube

下載然之源碼包,解壓后得到ranzhi文件夾,將里面的所有文件上傳到網(wǎng)站根目錄下。

站點(diǎn)設(shè)置

1.運(yùn)行名錄設(shè)置

在寶塔面板的網(wǎng)站管理中,點(diǎn)擊相應(yīng)站點(diǎn)的設(shè)置按鈕,在網(wǎng)站目錄中設(shè)置運(yùn)行目錄。將運(yùn)行目錄指向/www目錄,如下圖:

2.配置文件設(shè)置

上面配置代碼如下:

注:配置文件中端口號(hào)、域名、站點(diǎn)根目錄等信息根據(jù)自己實(shí)際情況填寫,切勿直接復(fù)制粘貼。

server
{
    listen 80;     #默認(rèn)為80端口,可根據(jù)需要修改為其他端口號(hào)
    server_name www.ranzhi.com;    #此處填寫實(shí)際域名
    index index.php index.html;
    root /www/wwwroot/www.ranzhi.com/www;    #次處填寫實(shí)際網(wǎng)站根目錄
    
    #SSL-START SSL相關(guān)配置,請(qǐng)勿刪除或修改下一行帶注釋的404規(guī)則
    #error_page 404/404.html;
    #SSL-END
    
    #ERROR-PAGE-START  錯(cuò)誤頁配置,可以注釋、刪除或修改
    error_page 404 /404.html;
    error_page 502 /502.html;
    #ERROR-PAGE-END
    
    location ^~ /sys
    {
        try_files $uri $uri/ /sys/index.php?$args;
        location ~ \.php
        {
            set $path_info $request_uri;
            if ($request_uri ~ "^/sys(/.*)$")
            {
              set $path_info $1;
            }
            fastcgi_index index.php;
            fastcgi_pass  unix:/tmp/php-cgi-70.sock; #根據(jù)實(shí)際啟動(dòng)的php版本選擇
            include /www/server/nginx/conf/fastcgi.conf;  # 需要根據(jù)具體路徑填寫
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
    }
    location ^~ /crm
    {
        try_files $uri $uri/ /crm/index.php?$args;
        location ~ \.php
        {
            set $path_info $request_uri;
            if ($request_uri ~ "^/crm(/.*)$")
            {
              set $path_info $1;
            }
            fastcgi_index index.php;
            fastcgi_pass  unix:/tmp/php-cgi-70.sock; #根據(jù)實(shí)際啟動(dòng)的php版本選擇
include /www/server/nginx/conf/fastcgi.conf;  # 需要根據(jù)具體路徑填寫
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
    }
    location ^~ /oa
    {
        try_files $uri $uri/ /oa/index.php?$args;
        location ~ \.php
        {
            set $path_info $request_uri;
            if ($request_uri ~ "^/oa(/.*)$")
            {
              set $path_info $1;
            }
            fastcgi_index index.php;
            fastcgi_pass  unix:/tmp/php-cgi-70.sock; #根據(jù)實(shí)際啟動(dòng)的php版本選擇
include /www/server/nginx/conf/fastcgi.conf;  # 需要根據(jù)具體路徑填寫
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
    }
    location ^~ /cash
    {
        try_files $uri $uri/ /cash/index.php?$args;
        location ~ \.php
        {
            set $path_info $request_uri;
            if ($request_uri ~ "^/cash(/.*)$")
            {   
              set $path_info $1; 
            }
            fastcgi_index index.php;
            fastcgi_pass  unix:/tmp/php-cgi-70.sock; #根據(jù)實(shí)際啟動(dòng)的php版本選擇
include /www/server/nginx/conf/fastcgi.conf;  # 需要根據(jù)具體路徑填寫
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
    }
    location ^~ /hr
    {
        try_files $uri $uri/ /hr/index.php?$args;
        location ~ \.php
        {
            set $path_info $request_uri;
            if ($request_uri ~ "^/hr(/.*)$")
            {
              set $path_info $1; 
            }
            fastcgi_index index.php;
            fastcgi_pass  unix:/tmp/php-cgi-70.sock; #根據(jù)實(shí)際啟動(dòng)的php版本選擇
include /www/server/nginx/conf/fastcgi.conf;  # 需要根據(jù)具體路徑填寫
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
    }
    location ^~ /psi
    {
        try_files $uri $uri/ /psi/index.php?$args;
        location ~ \.php
        {
            set $path_info $request_uri;
            if ($request_uri ~ "^/psi(/.*)$")
            {
              set $path_info $1;
            }
            fastcgi_index index.php;
            fastcgi_pass  unix:/tmp/php-cgi-70.sock; #根據(jù)實(shí)際啟動(dòng)的php版本選擇
include /www/server/nginx/conf/fastcgi.conf;  # 需要根據(jù)具體路徑填寫
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
    }
    location ^~ /flow
    {
        try_files $uri $uri/ /flow/index.php?$args;
        location ~ \.php
        {
            set $path_info $request_uri;
            if ($request_uri ~ "^/flow(/.*)$")
            {
              set $path_info $1; 
            }
            fastcgi_index index.php;
            fastcgi_pass  unix:/tmp/php-cgi-70.sock; #根據(jù)實(shí)際啟動(dòng)的php版本選擇
include /www/server/nginx/conf/fastcgi.conf;  # 需要根據(jù)具體路徑填寫
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
    }
    location ^~ /editor
    {
        try_files $uri $uri/ /editor/index.php?$args;
        location ~ \.php
        {
            set $path_info $request_uri;
            if ($request_uri ~ "^/editor(/.*)$")
            {
              set $path_info $1; 
            }
            fastcgi_index index.php;
            fastcgi_pass  unix:/tmp/php-cgi-70.sock; #根據(jù)實(shí)際啟動(dòng)的php版本選擇
include /www/server/nginx/conf/fastcgi.conf;  # 需要根據(jù)具體路徑填寫
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
    }
    location ^~ /team
    {
        try_files $uri $uri/ /team/index.php?$args;
        location ~ \.php
        {
            set $path_info $request_uri;
            if ($request_uri ~ "^/team(/.*)$")
            {
              set $path_info $1; 
            }
            fastcgi_index index.php;
            fastcgi_pass  unix:/tmp/php-cgi-70.sock; #根據(jù)實(shí)際啟動(dòng)的php版本選擇
include /www/server/nginx/conf/fastcgi.conf;  # 需要根據(jù)具體路徑填寫
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
    }
    location ~ \.php
    {
        fastcgi_index index.php;
        fastcgi_pass  unix:/tmp/php-cgi-70.sock; #根據(jù)實(shí)際啟動(dòng)的php版本選擇
        fastcgi_param PATH_INFO $request_uri;
include /www/server/nginx/conf/fastcgi.conf;  # 需要根據(jù)具體路徑填寫
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
    
    #禁止訪問的文件或目錄
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
    
    #一鍵申請(qǐng)SSL證書驗(yàn)證目錄相關(guān)設(shè)置
    location ~ \.well-known{
        allow all;
    }
    
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log off;
        access_log off;
    }
    
    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log off;
        access_log off; 
    }
    access_log  /www/wwwlogs/www.ranzhi.com.log;
    error_log  /www/wwwlogs/www.ranzhi.com.error.log;
}

設(shè)置后,重啟nginx。

安裝然之

注: 請(qǐng)確保域名已經(jīng)解析到服務(wù)器上。

瀏覽器訪問 http://域名:端口/sys/install.php,進(jìn)入安裝界面。  

檢查模塊和目錄權(quán)限:

備注:如果模塊或者目錄檢查不通過的話,請(qǐng)按照系統(tǒng)給出的提示進(jìn)行操作以解決問題。

數(shù)據(jù)庫(kù)配置:

設(shè)置管理員:

安裝成功后,即可使用上面設(shè)置的管理員賬號(hào)登錄然之系統(tǒng)。


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)