简体   繁体   English

如何在服务器上部署laravel项目?

[英]How to deploy laravel project on Server?

I built a linux server on digitialocean and installed require software and clone laravel files from github to /var/www/html/. 我在digitialocean上构建了一个linux服务器,并安装了需要的软件,并将laravel文件从github克隆到/ var / www / html /。 I get this error 我得到这个错误

 "The 138.68.81.200 page isn’t working" in http://138.68.81.200/socialNetwork/public/

Even though uploading migrations and create .env files and storage/* 777 permission. 即使上传迁移并创建.env文件和storage / * 777权限。

How can I solve this problem ? 我怎么解决这个问题 ?

Assuming that you have installed all php packages and dependencies and all project vendors via composer. 假设您已经通过composer安装了所有php软件包和依赖项以及所有项目供应商。 You just need to add this to /etc/apache2/sites-available/000-default.conf 您只需要将此添加到/etc/apache2/sites-available/000-default.conf

Alias /socialNetwork /var/www/html/socialNetwork/public/
<Directory "/var/www/html/socialNetwork/public">
        AllowOverride All
        Order allow,deny
        allow from all
</Directory>

And then add this in your /var/www/html/socialNetwork/public/.htaccess : 然后将其添加到您的/var/www/html/socialNetwork/public/.htaccess

Options +FollowSymLinks
RewriteEngine On

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

After that: 之后:

sudo service apache2 restart

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM