laravel和digitalocean安装灯

时间:2016-01-06 20:54:18

标签: apache laravel lamp digital-ocean

嘿伙计们我试图在我的digitalocean Droplet上安装laravel 5.1并且我已经完成了以下步骤

1

sudo apt-get update
sudo apt-get dist-upgrade

2。启用Apache mod_rewrite模块

sudo a2enmod rewrite

3 - 知道你的mysql密码

cat /etc/motd.tail

4 - 更改密码

mysqladmin -u root -p'password' password newpassword

5 - 安装Composer,运行以下命令:

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

6 - 如果你正在使用Git,你可以很容易地安装它:

sudo apt-get install git

7 - 现在转到/ var / www安装第一个应用程序

cd /var/www
composer create-project laravel/laravel your-project-name --prefer-dist

如果在命令运行时遇到错误,请执行以下错误:以下异常是由内存不足引起的,并且没有配置交换,例如,您可以使用以启用交换

cd~
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1

8 - Apache vHost PHP文件

检查开箱即用的Apache虚拟主机。可用的站点位于站点中,而启用的站点可以从站点符号链接 - 可用于站点启用。

我们将在/etc/apache2/sites-available/my_app.conf中创建新的虚拟主机:

sudo nano ../etc/apache2/sites-available/my_app.conf

并粘贴

<VirtualHost *:80>
    ServerName my-site.com
    ServerAlias Xxx.ZxZ.1X7.XxX #your server ip

    DocumentRoot /var/www/your-project-name/public
    <Directory /var/www/your-project-name/public>
        # Don't show directory index
        Options -Indexes +FollowSymLinks +MultiViews

        # Allow .htaccess files
        AllowOverride All

        # Allow web access to this directory
        Require all granted
    </Directory>

    # Error and access logs
    ErrorLog ${APACHE_LOG_DIR}/my-site.error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/my-site.access.log combined
</VirtualHost>

现在使用Apache2的Ubuntu软件包附带的Apache工具启用虚拟主机:

# Symlink it to sites-enabled directory
sudo a2ensite my_app

# Reload Apache so the new configuration is loaded
sudo service apache2 reload

所有这些信息都是从这里复制的 https://laracasts.com/discuss/channels/laravel/install-laravel-on-digitalocean-by-lamp

在完成所有这些步骤后,我的域名仍指向

var/www/html/index.php

这是Apache2 Ubuntu默认页面。我甚至尝试将apache文件配置到我的工作环境,它仍然指向该目录。有任何想法吗?谢谢!

仍然无效的更新VHOST文件

<VirtualHost *:80>
    ServerName my-site.com
    ServerAlias 159.203.224.150 #your server ip

    DocumentRoot /var/www/collabbro/public
    <Directory /var/www/collabbro/public>
        # Don't show directory index
        Options -Indexes +FollowSymLinks +MultiViews

        # Allow .htaccess files
        AllowOverride All

        # Allow web access to this directory
        Require all granted
    </Directory>

    # Error and access logs
    ErrorLog ${APACHE_LOG_DIR}/my-site.error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/my-site.access.log combined
</VirtualHost>

再次更新 这次我按照这个教程

https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts

<VirtualHost *:80>
        ServerAdmin example@gmail.com
        ServerName example.com
        ServerAlias www.example.com
        DocumentRoot /var/www/example/public
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

现在我收到 500服务器错误

1 个答案:

答案 0 :(得分:1)