OpenSUSE에서 Apache의 문서 루트가 이고 /srv/www/htdocs
해당 폴더에 내 웹 사이트와 자체 index.php
파일만 포함되어 있는 경우 브라우저에 "localhost"를 입력하면 홈 페이지로 이동됩니다.
그러나 실제로는 그렇지 않습니다!
작동하는 곳으로 이동합니다! 대신 페이지.
해당 폴더에 index.html 파일이 없으므로 문서 루트가 다른 곳을 가리키도록 변경하는 것은 무엇이며 어디를 가리킵니까?
이것은 상단의 주석 덩어리를 뺀 httpd.conf의 출력입니다.
### Global Environment ######################################################
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests.
# run under this user/group id
Include /etc/apache2/uid.conf
# - how many server processes to start (server pool regulation)
# - usage of KeepAlive
Include /etc/apache2/server-tuning.conf
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
ErrorLog /var/log/apache2/error_log
# generated from APACHE_MODULES in /etc/sysconfig/apache2
Include /etc/apache2/sysconfig.d/loadmodule.conf
# IP addresses / ports to listen on
Include /etc/apache2/listen.conf
# predefined logging formats
Include /etc/apache2/mod_log_config.conf
# generated from global settings in /etc/sysconfig/apache2
Include /etc/apache2/sysconfig.d/global.conf
# optional mod_status, mod_info
Include /etc/apache2/mod_status.conf
Include /etc/apache2/mod_info.conf
# optional cookie-based user tracking
# read the documentation before using it!!
Include /etc/apache2/mod_usertrack.conf
# configuration of server-generated directory listings
Include /etc/apache2/mod_autoindex-defaults.conf
# associate MIME types with filename extensions
TypesConfig /etc/apache2/mime.types
DefaultType text/plain
Include /etc/apache2/mod_mime-defaults.conf
# set up (customizable) error responses
Include /etc/apache2/errors.conf
# global (server-wide) SSL configuration, that is not specific to
# any virtual host
Include /etc/apache2/ssl-global.conf
# forbid access to the entire filesystem by default
<Directory />
Options None
AllowOverride None
Order deny,allow
Deny from all
</Directory>
# use .htaccess files for overriding,
AccessFileName .htaccess
# and never show them
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>
# List of resources to look for when the client requests a directory
DirectoryIndex index.html index.html.var
### '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.
#
Include /etc/apache2/default-server.conf
# Another way to include your own files
#
# The file below is generated from /etc/sysconfig/apache2,
# include arbitrary files as named in APACHE_CONF_INCLUDE_FILES and
# APACHE_CONF_INCLUDE_DIRS
Include /etc/apache2/sysconfig.d/include.conf
### Virtual server configuration ############################################
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs-2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
Include /etc/apache2/vhosts.d/*.conf
# Note: instead of adding your own configuration here, consider
# adding it in your own file (/etc/apache2/httpd.conf.local)
# putting its name into APACHE_CONF_INCLUDE_FILES in
# /etc/sysconfig/apache2 -- this will make system updates
# easier :)
답변1
index.php를 실행하기 위해 localhost url을 원한다고 생각합니다. httpd conf 파일에 다음을 추가하고 httpd를 다시 시작하십시오.
DirectoryIndex index.html index.php
귀하의 아파치 서버가 PHP를 실행하도록 올바르게 구성되었다고 가정합니다. 게시한 구성은 conf가 대부분 conf이고 실제 구성이 적기 때문에 그다지 유용하지 않습니다. 글쎄, 내 가정이 정확하다면 DirectoryIndex가 그 트릭을 수행해야 합니다. DirectoryIndex에 대해 자세히 알아보세요.http://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex
답변2
좋아, .htaccess에서 RewriteBase/ 줄의 주석 처리를 제거하여 문제를 해결했습니다.
간단해 보이지만 Drupal에서는 이전에 이 작업을 수행한 적이 없습니다.