搜尋
首頁php框架YIInginx不支援yii怎麼辦

nginx不支援yii怎麼辦

Feb 03, 2020 am 10:25 AM
nginxyii

nginx不支援yii怎麼辦

nginx不支援yii怎麼辦? nginx部署yii2的方法

只需要修改nginx.config設定檔內容,在裡面增加server,並且root寫成index.php檔案在的目錄下就可以

還要設定config/web.php裡的cookieValidationKey值,以及一些目錄的存取權限需要設定成777

nginx設定檔內容

#user  nobody;
worker_processes  1;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid        logs/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    #access_log  logs/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    #gzip  on;
    server {
        listen       80;
        server_name  localhost;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
        location / {
            root   html;
            index  index.php index.html index.htm;
        }
        #error_page  404              /404.html;
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
            include         fastcgi.conf;
        }
        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    #yi正mjh graduation project config
    server {
        charset utf-8;
        client_max_body_size 128M;
           
        listen 8080;
        server_name www.mjh.com;
        root    /var/www/mjhGraduation/web;
        index   index.php;
        access_log      /var/www/mjhGraduation/access.log main;
        error_log       /var/www/mjhGraduation/error.log;
        location /{
                 # Redirect everything that isn't a real file to index.php
                try_files $uri $uri/ /index.php?args;
        }
        location ~ \.php$ {
                include fastcgi.conf;
                fastcgi_pass 127.0.0.1:9000;
                try_files $uri = 404;
        }
        error_page 404 /404.html;
        location ~ /\.(ht|svn|git){
                deny all;
        }
    }
    #gsh graduation project config
    server {
        charset utf-8;
        client_max_body_size 128M;
           
        listen 8088;
        server_name www.mjh.com;
        root    /var/www/gshGraduation/web;
        index   index.php;
        access_log      /var/www/gshGraduation/access.log main;
        error_log       /var/www/gshGraduation/error.log;
        location /{
                 # Redirect everything that isn't a real file to index.php
                try_files $uri $uri/ /index.php?args;
        }
        location ~ \.php$ {
                include fastcgi.conf;
                fastcgi_pass 127.0.0.1:9000;
                try_files $uri = 404;
        }
        error_page 404 /404.html;
        location ~ /\.(ht|svn|git){
                deny all;
        }
    }
    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;
    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
}

相關文章教學推薦:yii教學

以上是nginx不支援yii怎麼辦的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
行動中的YII:當前的應用程序和項目行動中的YII:當前的應用程序和項目Apr 24, 2025 am 12:03 AM

Yii框架適用於企業級應用、中小型項目和個人項目。 1)在企業級應用中,Yii的高性能和可擴展性使其在電商平台等大型項目中表現出色。 2)中小型項目中,Yii的Gii工具幫助快速搭建原型和MVP。 3)個人項目和開源項目中,Yii的輕量級特性使其適合小型網站和博客。

使用YII:創建強大而可擴展的Web解決方案使用YII:創建強大而可擴展的Web解決方案Apr 23, 2025 am 12:16 AM

Yii框架適合構建高效、安全和可擴展的Web應用。 1)Yii基於MVC架構,提供組件化設計和安全特性。 2)它支持基本CRUD操作和高級RESTfulAPI開發。 3)提供日誌記錄和調試工具欄等調試技巧。 4)建議使用緩存和延遲加載進行性能優化。

YII的目的:快速有效地構建Web應用程序YII的目的:快速有效地構建Web應用程序Apr 22, 2025 am 12:07 AM

Yii的目的是讓開發者快速、高效地構建Web應用。其實現通過以下方式:1)組件化設計和MVC架構提高代碼可維護性和可重用性;2)Gii工具自動生成代碼,提升開發速度;3)延遲加載和緩存機制優化性能;4)靈活的擴展性便於集成第三方庫;5)提供RBAC功能處理複雜業務邏輯。

YII的多功能性:從簡單站點到復雜的項目YII的多功能性:從簡單站點到復雜的項目Apr 21, 2025 am 12:08 AM

1)簡單站點,yiioOfferSeaseAseaseAseaseAseAseAseAseAseAseAseAseAseAseAseAseAseAseAseAseAseAseAseAseAseAseAssetUpandRapidDevelopment.2)forcomplexprojects,ItmodularityAndrbacSystemManagesManagesManageSmanageScalagionsalageScalabilityscalability calability andsecurity andsecurity andsecurity。

yii和PHP框架的未來yii和PHP框架的未來Apr 20, 2025 am 12:11 AM

Yii框架在未來PHP框架發展中將繼續扮演重要角色。 1)Yii提供高效的MVC架構、強大的ORM系統、內置緩存機制和豐富擴展庫。 2)其組件化設計和靈活性使其適用於復雜業務邏輯和RESTfulAPI開發。 3)Yii不斷更新以適應現代PHP特性和技術趨勢,如微服務和容器化。

YII行動:現實世界中的示例和應用程序YII行動:現實世界中的示例和應用程序Apr 19, 2025 am 12:03 AM

Yii框架適合開發各種規模的Web應用,其優勢在於高性能和豐富的功能集。 1)Yii採用MVC架構,核心組件包括ActiveRecord、Widget和Gii工具。 2)通過請求處理流程,Yii高效處理HTTP請求。 3)基本用法展示了創建控制器和視圖的簡單示例。 4)高級用法通過ActiveRecord展示了數據庫操作的靈活性。 5)調試技巧包括使用調試工具欄和日誌系統。 6)性能優化建議使用緩存和數據庫查詢優化,遵循編碼規範和依賴注入以提高代碼質量。

yii2怎麼顯示錯誤提示yii2怎麼顯示錯誤提示Apr 18, 2025 pm 11:09 PM

在 Yii2 中,顯示錯誤提示有兩種主要方法。一種是使用 Yii::$app->errorHandler->exception(),在異常發生時自動捕獲和顯示錯誤。另一種是使用 $this->addError(),在模型驗證失敗時顯示錯誤,並可以在視圖中通過 $model->getErrors() 訪問。視圖中,可以用 if ($errors = $model->getErrors())

yi2和tp5區別有哪些yi2和tp5區別有哪些Apr 18, 2025 pm 11:06 PM

随着PHP框架技术的不断发展,Yi2和TP5作为两大主流框架备受关注。它们都以出色的性能、丰富的功能和健壮性著称,但却存在着一些差异和优劣势。了解这些区别对于开发者在选择框架时至关重要。

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

VSCode Windows 64位元 下載

VSCode Windows 64位元 下載

微軟推出的免費、功能強大的一款IDE編輯器

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

強大的PHP整合開發環境

MantisBT

MantisBT

Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

mPDF

mPDF

mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),