Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
616 views
in Technique[技术] by (71.8m points)

httpd.conf - EC2 linux apache cannot serve directory

I'm working on a clients site on EC2. The site is Drupal 7 based and located at /var/www/html but I get the following error in cloudwatch:

[Fri Feb 05 14:43:50.646217 2021]
[autoindex:error]
[pid 3401]
[client 10.0.0.62:36030]
AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive

In my Drupal root I can confirm there is an index.php with code in it but the website just shows an Apache holding page with a message saying:

You may now add content to the directory /var/www/html/. Note that until you do so, people visiting your website will see this page, and not your content.

When that message is not displaying, a

503 Service Temporarily Unavailable

is displayed instead.

In /etc/httpd/conf/httpd.conf, I have the following:

DocumentRoot "/var/www/html"

And . . .

<IfModule dir_module>
    DirectoryIndex index.php
</IfModule>

My apache status is as follows:

sh-4.2$ sudo systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/httpd.service.d
           └─php-fpm.conf
   Active: active (running) since Fri 2021-02-05 17:18:17 GMT; 23min ago
     Docs: man:httpd.service(8)
 Main PID: 7529 (httpd)
   Status: "Total requests: 4709; Idle/Busy workers 100/0;Requests/sec: 3.29; Bytes served/sec:  18KB/sec"
   CGroup: /system.slice/httpd.service
           ├─7529 /usr/sbin/httpd -DFOREGROUND
           ├─7531 /usr/sbin/httpd -DFOREGROUND
           ├─7532 /usr/sbin/httpd -DFOREGROUND
           ├─7533 /usr/sbin/httpd -DFOREGROUND
           ├─7534 /usr/sbin/httpd -DFOREGROUND
           ├─7535 /usr/sbin/httpd -DFOREGROUND
           ├─7577 /usr/sbin/httpd -DFOREGROUND
           ├─7583 /usr/sbin/httpd -DFOREGROUND
           ├─7589 /usr/sbin/httpd -DFOREGROUND
           ├─7627 /usr/sbin/httpd -DFOREGROUND
           └─7717 /usr/sbin/httpd -DFOREGROUND

With all the above, I don't understand why my website is not behaving normally.

I welcome any help and thanks in advance.

question from:https://stackoverflow.com/questions/66068547/ec2-linux-apache-cannot-serve-directory

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...