拯救php效能的神器webman-使用後臺webman-admin

李照耀發表於2024-03-15

在webman的外掛市場裡面發現了這個 webman-admin

安裝的話很簡單,就是在已經安裝了 webman 的目錄裡面執行 composer require -W webman/admin

安裝過程提示這些

拯救php效能的神器webman-使用後臺webman-admin
Using version ^0.6.24 for webman/admin
./composer.json has been updated
Running composer update webman/admin --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Lock file operations: 34 installs, 0 updates, 0 removals
  - Locking brick/math (0.12.1)
  - Locking carbonphp/carbon-doctrine-types (2.1.0)
  - Locking doctrine/inflector (2.0.10)
  - Locking guzzlehttp/guzzle (7.8.1)
  - Locking guzzlehttp/promises (2.0.2)
  - Locking guzzlehttp/psr7 (2.6.2)
  - Locking illuminate/bus (v10.48.2)
  - Locking illuminate/collections (v10.48.2)
  - Locking illuminate/conditionable (v10.48.2)
  - Locking illuminate/container (v10.48.2)
  - Locking illuminate/contracts (v10.48.2)
  - Locking illuminate/database (v10.48.2)
  - Locking illuminate/events (v10.48.2)
  - Locking illuminate/macroable (v10.48.2)
  - Locking illuminate/pagination (v10.48.2)
  - Locking illuminate/pipeline (v10.48.2)
  - Locking illuminate/support (v10.48.2)
  - Locking intervention/image (2.7.2)
  - Locking nesbot/carbon (2.72.3)
  - Locking psr/clock (1.0.0)
  - Locking psr/http-client (1.0.3)
  - Locking psr/http-factory (1.0.2)
  - Locking psr/http-message (2.0)
  - Locking psr/simple-cache (3.0.0)
  - Locking ralouphie/getallheaders (3.0.3)
  - Locking symfony/deprecation-contracts (v3.4.0)
  - Locking symfony/polyfill-mbstring (v1.29.0)
  - Locking symfony/polyfill-php80 (v1.29.0)
  - Locking symfony/translation (v6.4.4)
  - Locking symfony/translation-contracts (v3.4.1)
  - Locking voku/portable-ascii (2.0.1)
  - Locking webman/admin (v0.6.24)
  - Locking webman/captcha (v1.0.2)
  - Locking webman/event (v1.0.5)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 34 installs, 0 updates, 0 removals
  - Installing brick/math (0.12.1): Extracting archive
  - Installing guzzlehttp/promises (2.0.2): Extracting archive
  - Installing ralouphie/getallheaders (3.0.3): Extracting archive
  - Installing psr/http-message (2.0): Extracting archive
  - Installing psr/http-factory (1.0.2): Extracting archive
  - Installing guzzlehttp/psr7 (2.6.2): Extracting archive
  - Installing voku/portable-ascii (2.0.1): Extracting archive
  - Installing symfony/translation-contracts (v3.4.1): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.29.0): Extracting archive
  - Installing symfony/deprecation-contracts (v3.4.0): Extracting archive
  - Installing symfony/translation (v6.4.4): Extracting archive
  - Installing symfony/polyfill-php80 (v1.29.0): Extracting archive
  - Installing psr/clock (1.0.0): Extracting archive
  - Installing carbonphp/carbon-doctrine-types (2.1.0): Extracting archive
  - Installing nesbot/carbon (2.72.3): Extracting archive
  - Installing illuminate/macroable (v10.48.2): Extracting archive
  - Installing psr/simple-cache (3.0.0): Extracting archive
  - Installing illuminate/contracts (v10.48.2): Extracting archive
  - Installing illuminate/conditionable (v10.48.2): Extracting archive
  - Installing illuminate/collections (v10.48.2): Extracting archive
  - Installing doctrine/inflector (2.0.10): Extracting archive
  - Installing illuminate/support (v10.48.2): Extracting archive
  - Installing illuminate/pipeline (v10.48.2): Extracting archive
  - Installing illuminate/bus (v10.48.2): Extracting archive
  - Installing illuminate/container (v10.48.2): Extracting archive
  - Installing psr/http-client (1.0.3): Extracting archive
  - Installing webman/event (v1.0.5): Extracting archive
  - Installing webman/captcha (v1.0.2): Extracting archive
  - Installing intervention/image (2.7.2): Extracting archive
  - Installing illuminate/pagination (v10.48.2): Extracting archive
  - Installing illuminate/events (v10.48.2): Extracting archive
  - Installing illuminate/database (v10.48.2): Extracting archive
  - Installing guzzlehttp/guzzle (7.8.1): Extracting archive
  - Installing webman/admin (v0.6.24): Extracting archive
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
Create config/plugin/webman/event
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
Create plugin/admin
17 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
16 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
View Code

服務要重新啟動一下 php start.php start

由於我們之前將監聽埠改為了 127.0.0.1:8787,所以這裡可以直接訪問 http://127.0.0.1:8787/app/admin

可以看到這樣的安裝介面

然後就按照這個配置一下,填資料庫密碼,然後下一步,提示這個

這就配置一下後臺使用者和密碼就行了

好了,提示是需要重啟後才能生效。

不過我這裡沒重啟,也能進入後臺,看到登入介面。

然後就拿剛剛的使用者名稱稱和密碼登入進去唄。

然後就是這個後臺首頁了

隨便點了幾個頁面,感覺後臺不錯。

這還有個構建表單的頁面,挺好

然後我就想這個地方監控了8787埠 ,總不能一直這樣訪問吧。還是配置個虛擬域名吧。

然後就是老生長談了。

編輯host sudo gedit /etc/hosts

增加一行 127.0.0.1 local.webmanadmin.com

增加檔案 sudo touch /etc/nginx/sites-available/local.webmanadmin.com.conf

編輯檔案內容如下:

server {
    listen 80;
    index index.php index.html index.htm index.nginx-debian.html;
    server_name local.webmanadmin.com;
        location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        # 轉發Cookie,設定 SameSite
        proxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";
        # 執行代理訪問真實伺服器
        proxy_pass http://127.0.0.1:8787;
        }
}

來到資料夾 cd /etc/nginx/sites-enabled

設定軟連結 sudo ln -s /etc/nginx/sites-available/local.webmanadmin.com.conf local.webmanadmin.com.conf

然後重啟 nginx sudo systemctl restart nginx.service

然後就訪問

我發現登入的時候驗證碼總是提示錯誤,後來我查了一下 把 nginx 配置裡面的這個proxy_cookie_path改了一下

proxy_cookie_path /app/ /;

之後重啟nginx sudo systemctl restart nginx.service

重啟webman php start.php start 就好了。

我以為是這裡path的問題,然後我又改回去了,又重新重啟,發現登入沒問題,感覺這裡挺奇怪的,不過還好現在能登入也沒問題了。

真是奇怪呢,不知道是不是哪兒的臨時錯誤,驗證碼的問題現在又好了。哈哈!

相關文章