在寶塔面板中安裝web環(huán)境必要的軟件,包括:
web服務:Apache或Nginx(不建議使用IIS) 本文以nginx為例講解(apache可以參考 源碼安裝的方式部署)。
數(shù)據(jù)庫:Mysql(推薦5.5/5.6)
PHP:PHP 5.4/5.5/5.6/7.0/7.1 都可以(本文以php7.0版本為例介紹如何安裝)
其他軟件工具,根據(jù)自己實際情況與需要來選擇安裝即可。
登錄寶塔面板,在站點管理中點擊“添加站點”。
綁定多個域名時,每個域名占一行;
默認會在建站目錄(/www/wwwroot/)下自動創(chuàng)建一個與域名同名的目錄作為網(wǎng)站根目錄;
數(shù)據(jù)庫選用mysql,并設置數(shù)據(jù)庫用戶名和密碼;
PHP選擇 PHP7版本。(本文操作及配置都以PHP7為例)。
注:本文以安裝然之開源版為例進行演示,如果您是要安裝然之專業(yè)版,需要先 安裝ioncube。
下載然之源碼包,解壓后得到ranzhi文件夾,將里面的所有文件上傳到網(wǎng)站根目錄下。
1.運行名錄設置
在寶塔面板的網(wǎng)站管理中,點擊相應站點的設置按鈕,在網(wǎng)站目錄中設置運行目錄。將運行目錄指向/www目錄,如下圖:
2.配置文件設置
上面配置代碼如下:
注:配置文件中端口號、域名、站點根目錄等信息根據(jù)自己實際情況填寫,切勿直接復制粘貼。
server { listen 80; #默認為80端口,可根據(jù)需要修改為其他端口號 server_name www.ranzhi.com; #此處填寫實際域名 index index.php index.html; root /www/wwwroot/www.ranzhi.com/www; #次處填寫實際網(wǎng)站根目錄 #SSL-START SSL相關配置,請勿刪除或修改下一行帶注釋的404規(guī)則 #error_page 404/404.html; #SSL-END #ERROR-PAGE-START 錯誤頁配置,可以注釋、刪除或修改 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ù)實際啟動的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ù)實際啟動的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ù)實際啟動的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ù)實際啟動的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ù)實際啟動的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ù)實際啟動的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ù)實際啟動的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ù)實際啟動的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ù)實際啟動的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ù)實際啟動的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; } #一鍵申請SSL證書驗證目錄相關設置 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; }
設置后,重啟nginx。
注: 請確保域名已經(jīng)解析到服務器上。
瀏覽器訪問 http://域名:端口/sys/install.php,進入安裝界面。
檢查模塊和目錄權限:
備注:如果模塊或者目錄檢查不通過的話,請按照系統(tǒng)給出的提示進行操作以解決問題。
數(shù)據(jù)庫配置:
設置管理員:
安裝成功后,即可使用上面設置的管理員賬號登錄然之系統(tǒng)。
更多建議: