LNMP 部署 CodeIgniter 項目

1 首先安裝LNMP (使用LNMP一鍵安裝包,感謝軍哥) 下載地址,步驟LNMP上面都有。

2 使用 vhost 增加一個虛擬主機

3 關鍵

去除 index.php 增加pathinfo支持

server{

listen 80;
        #listen [::]:80;
        server_name 你的域名;
        index index.html index.htm index.php default.html default.htm default.php;
        root  你的網(wǎng)站在服務器目錄;

        include other.conf;
        #error_page   404   /404.html;

        ## pathinfo支持
        location ~ [^/]\.php(/|$)
        {
            # comment try_files $uri =404; to enable pathinfo
            #try_files $uri =404;
            fastcgi_pass  unix:/tmp/php-cgi.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
            include pathinfo.conf;
        }
        
         ## 去除index.php
        location /{
            if (!-e $request_filename) {
                rewrite ^/(.*)$ /index.php?$1 last;  
                break;
            }
        }

      location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        access_log  /mnt/wwwlogs/you log name.log  access;  ## log目錄
}
最后編輯于
?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容