[英]Apache Rendering 403 error
我正在尝试创建用于安装Wordpress的食谱。 一切似乎都还不错,除了参观视线时出现403错误。 You don't have permission to access / on this server.
include_recipe 'wp::httpd'
include_recipe 'mariadb'
# include_recipe 'wp::mysql'
include_recipe 'wp::wordpress'
directory(node[:wp][:app_root])
web_app(node[:wp][:app_name]) do
server_name(node[:wp][:server_name])
docroot(node[:wp][:app_root])
template('vhost.conf.erb')
end
ruby_block 'install_wordpress' do
block do
require 'fileutils'
FileUtils.cd node[:wp][:app_root]
system 'wget https://wordpress.org/latest.tar.gz'
system 'tar -xzf latest.tar.gz --strip-components=1 && rm latest.tar.gz'
end
not_if { ::File.exist?(File.join(node[:wp][:app_root], 'wp-settings.php')) }
action :create
end
template("#{node[:wp][:app_root]}/wp-config.php") do
source('wp-config.php.erb')
variables(
db_name: node[:wp][:app_name],
db_user: node[:wp][:app_name],
db_password: node[:wp][:db_password]
)
end
execute 'set_apache_as_owner' do
command "chown #{node['apache']['user']} -R #{node[:wp][:app_root]}"
end
<VirtualHost *:80>
ServerName <%= @params[:server_name] %>
DocumentRoot <%= @params[:docroot] %>
<Directory <%= @params[:docroot] %>>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
LogLevel info
ErrorLog <%= @node[:apache][:log_dir] %>/<%= @params[:name] %>-error.log
CustomLog <%= @node[:apache][:log_dir] %>/<%= @params[:name] %>-access.log combined
</VirtualHost>
您需要在其中添加一些authz行,以允许访问docroot。 通常,这将Require all granted
Apache 2.4在Directory
块中Require all granted
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.