流浪者在文档根目录上失败



我正在尝试设置一个新的流浪者盒子。我的 bash 脚本看起来像这样

#!/usr/bin/env bash
echo "--- Good morning, master. Let's get to work. Installing now. ---"
echo "--- Updating packages list ---"
sudo apt-get update
echo "--- MySQL time ---"
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
echo "--- Installing base packages ---"
sudo apt-get install -y vim curl python-software-properties
echo "--- Updating packages list ---"
sudo apt-get update
echo "--- We want the bleeding edge of PHP, right master? ---"
sudo add-apt-repository -y ppa:ondrej/php5
echo "--- Updating packages list ---"
sudo apt-get update
echo "--- Installing PHP-specific packages ---"
sudo apt-get install -y php5 apache2 libapache2-mod-php5 php5-curl php5-gd php5-mcrypt mysql-server-5.5 php5-mysql git-core
echo "--- Installing and configuring Xdebug ---"
sudo apt-get install -y php5-xdebug
cat << EOF | sudo tee -a /etc/php5/mods-available/xdebug.ini
xdebug.scream=1
xdebug.cli_color=1
xdebug.show_local_vars=1
EOF
echo "--- Enabling mod-rewrite ---"
sudo a2enmod rewrite
echo "--- Setting document root ---"
sudo rm -rf /var/www
sudo ln -fs /vagrant/public /var/www

echo "--- What developer codes without errors turned on? Not you, master. ---"
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/apache2/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/apache2/php.ini
sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
echo "--- Restarting Apache ---"
sudo service apache2 restart
echo "--- Composer is the future. But you knew that, did you master? Nice job. ---"
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
echo "--- All set to go! Would you like to play a game? ---"

虽然当我在终端中运行vagrant up时出现此错误

--- What developer codes without errors turned on? Not you, master. ---
--- Restarting Apache ---
* Restarting web server apache2
AH00112: Warning: DocumentRoot [/var/www] does not exist
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
...done.

我已经使用查找器搜索了/var/www,并被带到了正确的文件夹。此文件夹的权限设置为 755

为什么它找不到文档根目录?

我可能不对,但我感觉到线条

echo "--- Setting document root ---"
sudo rm -rf /var/www
sudo ln -fs /vagrant/public /var/www

给你问题

/vargrant/public权利也应该没问题

如果我选择,我可能不会删除/var/www

对我来说安全的象征性链接也是

sudo ln -fs  /var/www /vagrant/public

至少你不会发现同样的错误

让我受益的其他要点是为什么您不能将虚拟主机目录设置为/vagrant/public apache.conf 文件中的路径

说附加文件

 <VirtualHost *:80>
DocumentRoot /vagrant/public
ServerName somenameorip
</VirtualHost>

相关内容

  • 没有找到相关文章