Apache laravel和digitalocean安装灯
嘿,伙计们,我正在尝试在我的digitalocean droplet上安装Laravel5.1,我已经完成了以下步骤 一, 二,。启用Apache mod_重写模块Apache laravel和digitalocean安装灯,apache,laravel,lamp,digital-ocean,Apache,Laravel,Lamp,Digital Ocean,嘿,伙计们,我正在尝试在我的digitalocean droplet上安装Laravel5.1,我已经完成了以下步骤 一, 二,。启用Apache mod_重写模块 sudo a2enmod rewrite 3-了解您的mysql密码 cat /etc/motd.tail 4-更改您的密码 mysqladmin -u root -p'password' password newpassword 5-安装Composer,运行以下命令: curl -sS https://getcompose
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>
所有这些信息都是从这里复制的
在所有这些步骤之后,我的域仍然指向
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>
ServerName my-site.com
ServerAlias 159.203.224.150#您的服务器ip
DocumentRoot/var/www/collabro/public
#不显示目录索引
选项-索引+FollowSymLinks+多视图
#允许.htaccess文件
允许超越所有
#允许web访问此目录
要求所有授权
#错误和访问日志
ErrorLog${APACHE_LOG_DIR}/my-site.error.LOG
#可能的值包括:调试、信息、通知、警告、错误、临界值、,
#警惕,埃默格。
日志级别警告
CustomLog${APACHE\u LOG\u DIR}/my-site.access.LOG组合
再次更新
这次我在这里学习了这个教程
服务器管理员example@gmail.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot/var/www/example/public
ErrorLog${APACHE_LOG_DIR}/error.LOG
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
现在我收到一个500服务器错误我通过以下链接修复了解决方案 配置我的apache 然后正确部署laravel 5.1
希望这对将来的人们有所帮助您对apache所需根目录的权限是什么?快速提问;您是否禁用了默认站点<代码>一个不同的默认值(或者不管它叫什么)?@ChrisForrence我不知道你在说什么。从一开始就对一切都很陌生。如果可能,请详细说明。当然,@helloworld。运行
ls/etc/apache2/sites enabled/
时,输出是什么?@ChrisForrence我得到以下文件000-default.conf
和my_app.conf
var/www/html/index.php
<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>
<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>