0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

laravel apach centos

Posted at

laravel apach centos
tags: mamp Apach
author: benchan
slide: false

※バージョンによって多少パス等違うかも

 
php7をapacheで利用する場合には、以下のモジュール設定を追加する必要がある。

/etc/httpd/conf/httpd.conf
<IfModule prefork.c>
  #LoadModule php5_module modules/libphp5.so
  LoadModule php7_module modules/libphp7.so
</IfModule>

 

今回は、/etc/httpd/conf/httpd.confの中にあるを書き換える。

/etc/httpd/conf/httpd.conf
<Directory "/var/www/html">
    Options +FollowSymLinks
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    Require all granted
    AllowOverride All
</Directory>

 

/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

httpd-vhosts.conf
NameVirtualHost *:443

<VirtualHost *:443>
    ServerAdmin admin@localhost
    DocumentRoot "/Documents/localhost"
    ServerName localhost

    SSLEngine on
    SSLCertificateFile /Applications/MAMP/conf/apache/ssl/localhost.crt
    SSLCertificateKeyFile /Applications/MAMP/conf/apache/ssl/localhost.key

</VirtualHost>

 これで編集は完了するので、再度systemctl restart httpd.serviceコマンドを実行する。

###うまくいかない時に

Laravelのプロジェクトでは[project-name]/public/配下をDocumentRootに設定する必要がある。

   chown -R apache:apache [project-name]
   chmod -R 777 [project-name]
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?