Laravel
  • Introduction
  • 常用語法
  • 結合Vue.js從無到有架設一個網站
  • 透過CMD新增File
  • Schedule
  • Annotation
  • Super Variable
  • API的設定
  • Create 新專案
  • Raw Expressions
  • Import - Export
  • JWT 外加 登入功能
  • Carbon
  • Storage 保存文件
  • Require_once
  • 設定apache將laravel專案run起來
  • 有關leftjoin的用法
  • Advanced Join Clauses
  • Call API方式
  • 產生新的APP_KEY
  • 程序優化技巧
  • composer update VS 手動丟檔
  • 全域變數被使用過
  • FB的SDK
Powered by GitBook
On this page
  • 將laravel專案在apache上可以run
  • 設定 Apache 建立 Laravel VirtualHost
  • 新增一組laravel的VirtualHost資料
  • 修改資料夾權限
  • 修改.htaccess檔
  • 重啟apache
  • 遇到的問題
  • 如果要一起run很多個專案的話請看下面的連結

Was this helpful?

設定apache將laravel專案run起來

將laravel專案在apache上可以run

可以使用Xshell的工具連上apache

設定 Apache 建立 Laravel VirtualHost

vi /etc/httpd/conf/httpd.conf

用/或是?搜尋Listen然後修改後面的參數,如下

Listen *:80

儲存離開(:wq)

新增一組laravel的VirtualHost資料

vi /etc/httpd/conf.d/(專案名+port).conf
    // ex: iscar_box80.conf
<VirtualHost *:80>
  DocumentRoot "/var/www/html/專案名/public"
  ServerName "此輸入你想要的url名稱"  // ex:stage-tw-box.iscarmg.com
  ErrorLog "/var/log/httpd/專案名_error.log"
  CustomLog "/var/log/httpd/專案名_access.log" combined
  DirectoryIndex index.php
  <Directory "/var/www/html/專案名/public">
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

儲存離開(:wq)

修改資料夾權限

chown -R apache.apache /var/www/html/專案名

chmod -R 755 /var/www/html/專案名

chmod -R 777 /var/www/html/專案名/storage

修改.htaccess檔

vi /var/www/html/專案名/public/.htaccess

在RewriteEngine On前新增一行

Options +FollowSymLinks

將 RewriteRule ^ index.php [L]

改為 RewriteRule ^(.+)$ /index.php [L]

儲存離開(:wq)

重啟apache

systemctl restart httpd.service

看會不會出現Laravel首頁

遇到的問題

1.當你連不上laravel

請查看httpd.conf檔裡面的DocumentRoot "這邊的路徑有沒有指到你的專案底下的public"

如果要一起run很多個專案的話請看下面的連結

PreviousRequire_onceNext有關leftjoin的用法

Last updated 5 years ago

Was this helpful?

測試

http://IP:80
點我點我