如何解决Yii2在此服务器上找不到请求的URL问题
我已经完成了Yii2的设置。任何缺陷都不可见。但是http: //advanced/frontend/web/index.php
等。它给出404警告。当我执行vagrant hostmanager
时,一切正常。但是一段时间后,我收到了新的404警报。
Not Found
The requested URL was not found on this server.
Apache/2.4.18 (Ubuntu) Server at portal Port 80
我的流浪者文件:
require 'yaml'
require 'fileutils'
domains = {
portal: 'portal',advanced:'advanced'
}
config = {
local: './config/vagrant-local.yml',example: './config/vagrant-local.example.yml'
}
# copy config from example if local config not exists
FileUtils.cp config[:example],config[:local] unless File.exist?(config[:local])
# read config
options = YAML.load_file config[:local]
# check github token
if options['github_token'].nil? || options['github_token'].to_s.length != 40
puts "You must place REAL GitHub token into configuration:\n/vagrant/config/vagrant-local.yml"
exit
end
# vagrant configurate
Vagrant.configure(2) do |config|
# select the box
config.vm.box = 'ubuntu/xenial32'
# should we ask about box updates?
config.vm.box_check_update = options['box_check_update']
config.vm.provider 'virtualbox' do |vb|
# machine cpus count
vb.cpus = options['cpus']
# machine memory size
vb.memory = options['memory']
# machine name (for VirtualBox UI)
vb.name = options['machine_name']
end
# machine name (for vagrant console)
config.vm.define options['machine_name']
# machine name (for guest machine console)
config.vm.hostname = options['machine_name']
# network settings
config.vm.network 'private_network',ip: options['ip']
# sync: folder 'portal' (host machine) -> folder '/var/www/portal' (guest machine)
config.vm.synced_folder '../portal','/var/www/portal',id: "vagrant-portal",owner: "vagrant",group: "www-data",mount_options: ["dmode=775,fmode=664"]
# sync: folder 'advanced' (host machine) -> folder '/var/www/advanced' (guest machine)
config.vm.synced_folder '../advanced','/var/www/advanced',id: "vagrant-advanced",fmode=664"]
# disable folder '/vagrant' (guest machine)
config.vm.synced_folder '.','/vagrant'
# hosts settings (host machine)
config.vm.provision :hostmanager
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
config.hostmanager.aliases = domains.values
# provisioners
config.vm.provision 'shell',path: './provision/once-as-root.sh',args: [options['timezone']]
config.vm.provision 'shell',path: './provision/always-as-root.sh',run: 'always'
end
advanced.conf;
<VirtualHost *:80>
ServerName advanced
DocumentRoot /var/www/advanced
<Directory /var/www/advanced>
Options -Indexes
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
我也检查了hosts文件,ips似乎已定义。 有人遇到过同样的情况并解决了吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。