Reputation: 1755
hey guys im trying to install laravel 5.1 on my digitalocean droplet and I've done the following steps
1.
sudo apt-get update
sudo apt-get dist-upgrade
2. enable the Apache mod_rewrite module
sudo a2enmod rewrite
3 - to know your mysql password
cat /etc/motd.tail
4 - to change your password
mysqladmin -u root -p'password' password newpassword
5 - install Composer, run these commands:
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
6 - if you're using Git you can install it very easily:
sudo apt-get install git
7 - now go to /var/www to install first app
cd /var/www
composer create-project laravel/laravel your-project-name --prefer-dist
if got a error when run above command Error like this: The following exception is caused by a lack of memory and not having swap configured you can use for example, to enable the swap
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 Files
Check Apache virtual hosts that come out of the box. Available ones are in sites-available while enabled ones are symlinked from sites-available to sites-enabled.
We'll create new virtual host at /etc/apache2/sites-available/my_app.conf:
sudo nano ../etc/apache2/sites-available/my_app.conf
and paste
<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>
Now Enable the Virtual Host using Apache's tool that comes with the Ubuntu package of Apache2:
# Symlink it to sites-enabled directory
sudo a2ensite my_app
# Reload Apache so the new configuration is loaded
sudo service apache2 reload
all of this info was copied from here https://laracasts.com/discuss/channels/laravel/install-laravel-on-digitalocean-by-lamp
after all of these steps my domain still points to
var/www/html/index.php
which is the Apache2 Ubuntu Default Page. I even tried configuring the apache file to my work environment and it still points to that directory. Any ideas? thanks!
UPDATED VHOST FILE which is still not working
<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>
UPDATED AGAIN this time i followed this tutorial here
<VirtualHost *:80>
ServerAdmin [email protected]
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>
now I am getting a 500 Server Error
Upvotes: 2
Views: 2175
Reputation: 1755
i fixed the solution with these following links
Configuring my apache
and then properly deploying laravel 5.1
hope this helps people in the future
Upvotes: 1