0

my env : Linux, maven, AWS EC2, Spring boot

I can see the main screen of the project when I connect to the Elastic IP of EC2. However, when I try to connect to the purchased .dev domain, I get an 403 error and Test Page of Apache.

I think, maybe I didn't enter the correct path. Or, The permission setting is incorrect.

So I modified the httpd.conf file, but it still doesn't solve the problem. Can you check which one is wrong?


Please Check my Code

The path to the file that needs to be executed is in "/home/ec2-user/project/src/main/WEB-INF/views/home.jsp".


etc/httpd/conf/httpd-le-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
    DocumentRoot "/home/ec2-user"
    ServerName "test.dev"
    ServerAlias "www.test.dev"
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/test.dev/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/test.dev/privkey.pem
</VirtualHost>
</IfModule>


etc/httpd/conf/httpd.conf

# set IP addresses

Listen 80
    
<VirtualHost *:80>
    DocumentRoot "/home/ec2-user"
    ServerName "test.dev"
    ServerAlias "www.test.dev"
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =www.test.dev [OR]
    RewriteCond %{SERVER_NAME} =test.dev
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>


# set Deny entirety <- default

<Directory />
    AllowOverride none
    Require all denied
</Directory>


# Directory custom setting

DocumentRoot "/home/ec2-user"

<Directory "/home/ec2-user">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

<Directory "/home/ec2-user">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

# Index position custom setting
<IfModule dir_module>
    DirectoryIndex /project/src/main/webapp/WEB-INF/views/home.jsp
</IfModule>


Error log

[core:error] [pid 7748] (13)Permission denied: [client XXX.XXX.XXX.XXX] 
AH00035: access to /project/src/main/webapp/WEB-INF/views/home.jsp denied 
(filesystem path '/home/ec2-user/project/src') because search permissions are 
missing on a component of the path

ec2-user's permissions enter image description here

project's permissions enter image description here

1 Answer 1

0

This problem was solved through struggling! I will share the situation I solved! First of all, the direction of approach was wrong from the start.

It was correct in my situation. Entering the path 'home/ec2-user' into the DocumentRoot. See the code below.

<VirtualHost *:80>
    DocumentRoot "/home/ec2-user"
    ServerName "test.dev"
    ServerAlias "www.test.dev"
    ~
</VirtualHost>

The httpd configuration should only be done up to this point. After that, changed all connections that access http (80 port) with Nginx to https (port 443).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .