目的:Apache2+UbuntuでCGIを動かすこと
【各環境情報】
[Apache2]:$apache2 -v
参考URL:https://goo.gl/S1A4Da
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2016-07-14T12:32:26
[Ubuntu]:$ cat /etc/lsb-release
参考URL:https://goo.gl/oWtKVN
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS"
[Bash]:$bash --version
bash --version
GNU bash, version 4.3.46(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
【手順】
①Apacheモジュールを有効可する
有効化対象は、cgid。
$ sudo a2enmod cgid
②mime.confを編集し、拡張子「.cgi」がcgi-scriptをして処理されるよう設定する
$ cd /etc/apache2/mods-enabled/
$ sudo vi mime.conf
220行目付近にある
#AddHandler cgi-script を
AddHandler cgi-script へ。
③設定ファイルを変更しCGIを有効化する設定とする
################
<Directory "/var/www/html">
AllowOverride All
Options ExecCGI Multiviews Indexes IncludesNoExec
</Directory>
################
↑が、CGIを有効化するおまじない
編集ファイルの場所:/etc/apache2/sites-available/000-default.conf
[編集後]
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory "/var/www/html">
AllowOverride All
Options ExecCGI Multiviews Indexes IncludesNoExec
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
④文法チェック
$ apachectl configtest
⑤再起動
$sudo service apache2 restart
このブログを検索
ラベル
- Apache2 (1)
- bitFlyer (1)
- BTC (1)
- BTCFX (1)
- CakePHP3 (1)
- CCXT (1)
- CentOS (1)
- C言語 (1)
- iPad (1)
- Javaのイロハ (9)
- Java言語 (1)
- Linux (8)
- mailman (1)
- Mecab (1)
- MySQL (1)
- Perl (1)
- PHP (2)
- Redmine (1)
- Shell Script (1)
- Ubuntu (2)
- VB.NET (5)
- Windows (1)
- yum update (1)
- yum使い方 (1)
- エディタ・ページャ (1)
- 開発環境 (1)
- 資格 (1)
- 自動売買 (1)
- 上流工程 (1)
-
マニュアル更新しました 2011年5月6日 => マニュアルダウンロード: 「 ここ 」 なにかあればコメントください。 <この記事と他のWebサイトの比較> 検証日:2011年4月29日 A . Windows上(Cygwin上)でiPh...
-
AWSのインスタンスとELBを利用した際に発生するToo Many Redirectが発生するときの対策↓ https://aws.amazon.com/jp/premiumsupport/knowledge-center/redirect-http-https-elb/ ...