Fedora 24를 설치하고 가상 호스트용 Apache 설정을 시도했습니다.
브라우저를 통해 액세스하려고 하면 "404 찾을 수 없음" 메시지가 나타납니다.
다음은 내 구성 파일과 오류 출력입니다 httpd -S
(현재 파일이 너무 많을 수 있음).
SElinux가 비활성화되었습니다.
httpd -S
산출:
AH00112: Warning: DocumentRoot [/home/www/apecenergy.co.uk/public_html] does not exist
AH00112: Warning: DocumentRoot [/home/www/rangayoga.co.uk/public_html] does not exist
VirtualHost configuration:
*:80 is a NameVirtualHost
default server www.apecenergy.co.uk (/etc/httpd/conf.d/httpd-vhosts.conf:23)
port 80 namevhost www.apecenergy.co.uk (/etc/httpd/conf.d/httpd-vhosts.conf:23)
alias www.apecenergy.co.uk
port 80 namevhost rangayoga.co.uk (/etc/httpd/conf.d/httpd-vhosts.conf:32)
alias www.rangayoga.co.uk
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/home/david/www"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
Mutex lua-ivm-shm: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex default: dir="/run/httpd/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex cache-socache: using_defaults
Mutex authdigest-opaque: using_defaults
PidFile: "/run/httpd/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="apache" id=48
Group: name="apache" id=48
!!!!(((문서 루트를 "david" 대신 "apache"가 소유해야 하는 경우 이제 마지막 두 줄에서 알 수 있습니다.)))!!!!
etc/hosts 파일:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 rangayoga.co.uk www.rangayoga.co.uk
127.0.0.1 apecenergy.co.uk www.apecenergy.co.uk
등/httpd/conf.d/httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin admin@apecenergy
DocumentRoot /home/www/apecenergy.co.uk/public_html
ServerName www.apecenergy.co.uk
ServerAlias www.apecenergy.co.uk
ErrorLog "/var/log/httpd/apecenergy-error_log"
CustomLog "/var/log/httpd/apecenergy-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/home/www/rangayoga.co.uk/public_html"
ServerName rangayoga.co.uk
ServerAlias www.rangayoga.co.uk
ErrorLog "/var/log/httpd/rangayoga.co.uk-error_log"
CustomLog "/var/log/httpd/rangayoga.co.uk-access_log" common
</VirtualHost>
ServerName 127.0.0.1
등/httpd/conf/httpd.conf (선택한 데이터, 전체 파일이 필요한 경우 문의하세요)
ServerRoot "/etc/httpd"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
Include conf.modules.d/*.conf
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User apache
Group apache
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. [email protected]
#
ServerAdmin root@localhost
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride none
Require all granted
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/home/david/www"
#
# Relax access to content within /var/www.
#
<Directory "/home/david/www">
AllowOverride None
# Allow open access:
Require all granted
</Directory>
# Further relax access to the default document root:
<Directory "/home/david/www">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ".ht*">
Require all denied
</Files>
답변1
의 처음 두 줄은 ( 및 )에 대한 올바른 디렉터리 구조를 만들지 httpd -S output
않았음을 분명히 보여줍니다 ./home/www/apecenergy.co.uk/public_html
/home/www/rangayoga.co.uk/public_html
이것만으로도 HTTP 404 오류가 발생하기에 충분합니다.