環境開発構築~Apache その4~

ちわーっす!
元気にしてますか?
COVID-19(コロナウイルス)に気を付けて生活してますか?

春先には収まることを祈るばかりです。

では、本題に入りましょう!
(ここまでコピペ(笑))

過去の投稿記事はこちらを見てね。

httpd.confを編集しよう。


# コメントアウト
LoadModule expires_module modules/mod_expires.so

# コメントアウト
LoadModule headers_module modules/mod_headers.so

# コメントアウト
LoadModule rewrite_module modules/mod_rewrite.so

# コメントアウト
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so

# コメントアウト
LoadModule ssl_module modules/mod_ssl.so

# LoadModule の最後に追加(PHPと関連付け)
LoadModule php7_module "C:/php/php7apache2_4.dll"

# ディレクトリー変更
<Directory />
# Order allow,deny
# Allow from all
Options FollowSymLinks Indexes Includes ExecCGI
AllowOverride All
Require all granted
</Directory>

# ドキュメント変更
DocumentRoot "D:/public_html"
<Directory "D:/public_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.
#
# CGIを起動
Options Indexes FollowSymLinks ExecCGI

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
# None -> All に変更
AllowOverride All

#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>

# モジュールの関連付け
<IfModule dir_module>
DirectoryIndex index.html index.htm index.shtml index.shtm index.php index.cgi index.pl
</IfModule>

<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar

#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.

#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
# CGIの関連付け
ScriptAlias /cgi-bin/ "C:/httpd/cgi-bin/"

# PHPの関連付け(追加)
ScriptAlias /php/ "C:/php/"

</IfModule>

# CGIを起動
<Directory "C:/httpd/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>

<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types

#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
# 200107 / Fujita
AddHandler cgi-script .cgi .pl

# For type maps (negotiated resources):
#AddHandler type-map var

#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
# HTMLの関連付け
AddType text/html .shtml
# フィルター関連付け
AddOutputFilter INCLUDES .shtml

# それぞれのプログラムコードの関連付け
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-cgi .cgi
AddType application/x-httpd-cgi .pl
</IfModule>

# 一番最後にPHP関連付けを追加
PHPIniDir "C:/php"
AddHandler php7-script .php
AddHandler application/x-httpd-php .php
AddType application/xhttpd-php-source .phps

以上、ここまで。

ではまた。

コメントする

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください

Leonard-Blogをもっと見る

今すぐ購読し、続きを読んで、すべてのアーカイブにアクセスしましょう。

続きを読む