導航:首頁 > 配伺服器 > tp5如何放到伺服器

tp5如何放到伺服器

發布時間:2023-06-18 16:37:17

1. 用TP5寫的項目幫了個域名,放到伺服器上怎麼訪問

以伺服器上的域名為准,將域名A解析指向伺服器IP,把項目放到phpstudy的默認目錄下就可以了

2. PHP如何配置TP框架,連接騰訊雲雲資料庫

需要你在阿里雲選擇一款伺服器配置,然後用第三方一鍵php包的配置,伺服器配置出可視化php環境界面,上傳程序,安裝網站,添加內容。

下載TP5完整版(初學者學慣用的)
解壓到本地的開發環境中,默認的入口文件是public,訪問public會看到TP5成功頁面。

開發一個項目的時候,通常分為前台和後台,前台一般放在index模塊中,後台一般放在admin模塊中。所以你想鏈接資料庫,就去 admin文件夾修改 database.php 連接資料庫時候讀取的文件,就可以了。

TP框架都這么操作出來的,這是個思路,因為這方面內容較多,這里也寫不開那麼多內容,在這留言或到咱們的blog找相關內容,可以幫助入門。

3. tp-link路由器的虛擬伺服器怎麼設置

TP-link路由器埠映射設置
1.設置埠映射首先需要判斷路由器的IP地址,一般就是您當前的上網網關啦。通過cmd命令行輸入 ipconfig 查看默認網關設置項目

在瀏覽器上打開默認網關地址如http://192.168.1.1 然後回車會彈出對話框要求登陸,一般默認的用戶名 admin 密碼是 admin

2.虛擬伺服器
打開tp-link系統裡面之後,找到 「轉發規則」---「虛擬伺服器」如下圖

3.點擊之後,進入「添加新條目」 根據內部埠和需要映射的IP地址

4.除此之外,如果映射的80埠外網訪問是路由器不是需要映射的伺服器,
這也就是web遠程管理。
找到 安全功能---遠程web管理 把遠程web管理關掉,或者修改其他埠

5.其他注意事項
埠映射設置可以把內網伺服器對外公開服務,如果是動態IP的話。一般由於ISP會把80埠封掉不能使用

4. Thinkphp5項目在nginx伺服器部署

1,切換到nginx的配置目錄,找到nginx.conf文件

    cd   /usr/local/nginx/conf

    vim  nginx.conf

2,如果是單項目部署的話,只需要在nginx.conf文件裡面加上以下

server{

        listen 80;

        # 域名,本地測試可以使用127.0.0.1或localhost

        server_name www.zhangc.cn;

        # php項目根目錄

        root /home/data-www/blog;

        location /{

                # 定義首頁索引文件的名稱

                index index.php index.html index.htm;

                # 影藏入口文件

                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;

                }

                try_files $uri $uri/ /index.php?$query_string;

        }

        # PHP 腳本請求全部轉發到 FastCGI處理. 使用FastCGI協議默認配置.

        # Fastcgi伺服器和程序(PHP)溝通的協議

        .location ~ .*\.php${

                # 設置監聽埠

                fastcgi_pass 127.0.0.1:9000;

                # 設置nginx的默認首頁文件

                fastcgi_index index.php;

                # 設置腳本文件請求的路徑

                fastcgi_param SCRIPT_FILENAME$document_root$fastcgi_script_name;

                # 引入fastcgi的配置文件

                include fastcgi_params;

                fastcgi_split_path_info ^(.+?\.php)(/.*)$;

                set $path_info $fastcgi_path_info;

                fastcgi_param PATH_INFO $path_info;

                try_files $fastcgi_script_name =404;

        }

}

3,如果多項目部署,就需要配置vhost

第一步:編輯nginx.conf文件,在最後加上     include    vhost/*.conf;

第二步:進入vhost文件夾,創建    域名.conf    文件,如創建一個:quanma.meyat.com.conf

第三步:編輯quanma.meyat.com.conf文件,內容如下:

        server

        {

                listen 80;

                server_name quanma.meyat.com;

                index index.html index.htm index.php default.html default.htm default.php;

                root /data/wwwroot/default/quanma/public/;

                #error_page 404 /404.html;

                location / {

                        index index.html index.php;

                        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;

                        }

                        try_files $uri $uri/ /index.php?$query_string;

                }

                location ~ [^/]\.php(/|$)

                {

                        # comment try_files $uri =404; to enable pathinfo

                        #try_files $uri =404;

                        fastcgi_pass 127.0.0.1:9000;

                        fastcgi_index index.php;

                        include fastcgi_params;

                        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

                        fastcgi_split_path_info ^(.+?\.php)(/.*)$;

                        set $path_info $fastcgi_path_info;

                        fastcgi_param PATH_INFO $path_info;

                        try_files $fastcgi_script_name =404;

                        #include fastcgi.conf;

                        #include pathinfo.conf;

            }

            location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

            {

                    expires 30d;

            }

            location ~ .*\.(js|css)?$

            {

                    expires 12h;

            }

            # Disallow access to .ht, .svn, .bzr, .git, .hg, .cvs directories

            location ~ /\.(ht|svn|bzr|git|hg|cvs) {

                    deny all;

            }

            #access_log /date/nginx/bmp.com.conf/access.log main;

}

閱讀全文

與tp5如何放到伺服器相關的資料

熱點內容
android待機流程 瀏覽:851
python直接退出程序 瀏覽:842
百戰程序員收費標准 瀏覽:776
時鍾置換演算法指針變化規則 瀏覽:245
微信加密能否改密碼 瀏覽:104
android許可權組 瀏覽:169
2017單片機 瀏覽:476
讓孩子感興趣編程的電影 瀏覽:261
用顏料製作脆皮解壓球 瀏覽:933
火箭解壓器 瀏覽:73
cnet中級程序員面試題 瀏覽:191
單片機怎麼做人臉識別 瀏覽:154
監獄辦理工商銀行app怎麼辦呢 瀏覽:819
c語言寫編程時需要用什麼輸入法 瀏覽:590
生發程序員 瀏覽:167
高考英語pdf 瀏覽:418
哈利波特忘記伺服器怎麼辦 瀏覽:824
怎麼看其他電腦共享文件夾 瀏覽:513
py文件夾後綴 瀏覽:723
你對我們的app有什麼建議 瀏覽:584