質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Apache

Apacheは、Apache HTTP Serverの略で、最も人気の高いWebサーバソフトウェアの一つです。安定性が高いオープンソースソフトウェアとして商用サイトから自宅サーバまで、多くのプラットフォーム向けに開発・配布されています。サーバーソフトウェアの不具合(NCSA httpd)を修正するパッチ(a patch)を集積、一つ独立したソフトウェアとして開発されました。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

Q&A

解決済

1回答

497閲覧

VagrantでcentOS環境にApacheを導入したい

hoshietoile

総合スコア11

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Apache

Apacheは、Apache HTTP Serverの略で、最も人気の高いWebサーバソフトウェアの一つです。安定性が高いオープンソースソフトウェアとして商用サイトから自宅サーバまで、多くのプラットフォーム向けに開発・配布されています。サーバーソフトウェアの不具合(NCSA httpd)を修正するパッチ(a patch)を集積、一つ独立したソフトウェアとして開発されました。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

0グッド

1クリップ

投稿2019/11/02 10:03

前提・実現したいこと

ここに質問の内容を詳しく書いてください。
vagrantを使って新しく仮想環境をつくっています。
Apacheを導入したいのですが、これまでDotinstallで配布されているスクリプトでの構築しか行ったことがなく、行き詰っております。

環境
centOS: 6.10
Apache: 2.2.15

発生している問題・エラーメッセージ

sudo yum -y update
sudo yum -y install httpd

をコマンドして、apacheをインストールしたのですが、

service httpd start

をすると

Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomai n for ServerName (13)Permission denied: make_sock: could not bind to address [::]:80 (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs

となり起動できません。

「ServerNameを変更する必要がある」
ということは分かったのですが、どのように編集すればいいのか、どのように編集すればよいのかがわかりません。(「ホスト名」が何を指すのかもわかっていません、、、)

vim で編集するため、

vi /etc/httpd/conf/httpd.conf

をコマンドすると、

# # This is the main Apache server configuration file. It contains the # configuration directives that give the server its instructions. # See <URL:http://httpd.apache.org/docs/2.2/> for detailed information. # In particular, see # <URL:http://httpd.apache.org/docs/2.2/mod/directives.html> # for a discussion of each configuration directive. # # # Do NOT simply read the instructions in here without understanding # what they do. They're here only as hints or reminders. If you are unsure # consult the online docs. You have been warned. # # The configuration directives are grouped into three basic sections: # 1. Directives that control the operation of the Apache server process as a # whole (the 'global environment'). # 2. Directives that define the parameters of the 'main' or 'default' server, # which responds to requests that aren't handled by a virtual host. # These directives also provide default values for the settings # of all virtual hosts. # 3. Settings for virtual hosts, which allow Web requests to be sent to # different IP addresses or hostnames and have them handled by the # same Apache server process. # # Configuration and logfile names: If the filenames you specify for many # of the server's control files begin with "/" (or "drive:/" for Win32), the # server will use that explicit path. If the filenames do *not* begin # with "/", the value of ServerRoot is prepended -- so "logs/foo.log" # with ServerRoot set to "/etc/httpd" will be interpreted by the # server as "/etc/httpd/logs/foo.log". # ### Section 1: Global Environment # # The directives in this section affect the overall operation of Apache, # such as the number of concurrent requests it can handle or where it # can find its configuration files. # # # Don't give away too much information about all the subcomponents # we are running. Comment out this line if you don't mind remote sites # finding out what major optional modules you are running ServerTokens OS # # ServerRoot: The top of the directory tree under which the server's # configuration, error, and log files are kept. # # NOTE! If you intend to place this on an NFS (or otherwise network) # mounted filesystem then please read the LockFile documentation # (available at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>); # you will save yourself a lot of trouble. # # Do NOT add a slash at the end of the directory path. # ServerRoot "/etc/httpd" # # PidFile: The file in which the server should record its process # identification number when it starts. Note the PIDFILE variable in "/etc/httpd/conf/httpd.conf" [readonly] 1009L, 34419C

とでて、Quiitaなどで紹介されているような、期待しているページとは異なる表示がされており、どのように対処すればよいのかわかりません。

環境構築についての知識が非常に浅いので、いろいろ調べつつやっているのですが、調べていても有益な情報が得られない(知識が足りなく理解ができない)場合が多く、現状に対処できておりません。

1 現在どのような原因でApacheが起動できていないのか
2 なぜUSER_NAMEなどの設定ファイルが開けていないのか
3 設定する必要がある「ホスト名」とは何を指すのか?
4 ServerNameをどのように設定すればよいのか

など、ご回答いただけたら大変助かります。
よろしくお願いします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

sudo yum -y update

sudo yum -y install httpd

をコマンドして、apacheをインストールしたのですが、

service httpd start

をすると

サービス起動もsudoで実施しましょう
sudo service httpd start

投稿2019/11/02 21:21

yukky1201

総合スコア2751

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

hoshietoile

2019/11/03 05:44

yukky1201様 ご返答いただいてありがとうございます! root権限つけたらいけました! すごく初歩的なミスだったのですね、お恥ずかしいです。 今後も、こちらのサイトでいろいろ質問を投稿させていただく機会があると思いますので、ぜひご回答をいただけたらと思います。 ありがとうございました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問