在內網中 暫時需要一臺 文件 伺服器,所以準備安裝一臺 http伺服器並開啟目錄訪問許可權。這次使用 apache 在 fedora 28 機器上: 因為 fedora 28 已經包含 httpd 軟體,使用 systemctl start httpd 就能進行啟動。 啟動時 預設開啟 目錄訪問許可權, ...
在內網中 暫時需要一臺 文件 伺服器,所以準備安裝一臺 http伺服器並開啟目錄訪問許可權。這次使用 apache 在 fedora 28 機器上:
因為 fedora 28 已經包含 httpd 軟體,使用
systemctl start httpd 就能進行啟動。
啟動時 預設開啟 目錄訪問許可權,但是首次訪問網站根目錄的時候,會顯示test page.
進入如下文件夾:
[root@dhcp-65-15 conf.d]# pwd /etc/httpd/conf.d
[root@dhcp-65-15 conf.d]# cat welcome.conf # # This configuration file enables the default "Welcome" page if there # is no default index page present for the root URL. To disable the # Welcome page, comment out all the lines below. # # NOTE: if this file is removed, it will be restored on upgrades. # <LocationMatch "^/+$"> Options -Indexes ErrorDocument 403 /.noindex.html </LocationMatch> <Directory /usr/share/httpd/noindex> AllowOverride None Require all granted </Directory>
進行註釋上述文件:
[root@dhcp-65-15 conf.d]# cat welcome.conf # # This configuration file enables the default "Welcome" page if there # is no default index page present for the root URL. To disable the # Welcome page, comment out all the lines below. # # NOTE: if this file is removed, it will be restored on upgrades. # #<LocationMatch "^/+$"> # Options -Indexes # ErrorDocument 403 /.noindex.html #</LocationMatch> #<Directory /usr/share/httpd/noindex> # AllowOverride None # Require all granted #</Directory> #Alias /.noindex.html /usr/share/httpd/noindex/index.html
httpd 文件配置如下所示:
<Directory "/var/www/html"> # # 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 None # # Controls who can get stuff from this server. # Require all granted </Directory>
Options indexes FollowSymLinks
這個配置表明為 開啟目錄許可權
結束後,你會看到如下所示畫面:
完成!
祝您使用愉快,小技術方便您的生活。
保持更新,轉載請註明出處。