LoginSignup
7

More than 5 years have passed since last update.

メモ:Vagrant環境でCGI(試行錯誤中)

Posted at

設定ファイルを編集。

sudo vim /etc/httpd/conf/httpd.conf

vimが開いたら以下の箇所のコメントを外す。コマンドモードで探すと早いかも(/cgi/gとか)。

#
AddHandler cgi-script .cgi  # 多分ここ?
#

再起動。

sudo service httpd restart

以下のようなファイルを作成。

hello.cgi
#!/usr/bin/env python
# -*- coding: utf-8 -*-

print "Content-Type: text/plain"
print
print "hello world!"

http://[アドレス]/hello.cgi にアクセス。表示されると思いきや・・・・

Forbidden

You don't have permission to access /hello.cgi on this server.

Permissionと書かれているので、chmod 755 hello.cgiとかをやってみたが変わらず。

他にもどこか設定が必要なのだろうか?

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7