skip to Main Content

I’m trying to get my site deployed using Laravel on an AWS EC2 instance running CentOS7. I’ve checked to make sure the ports and traffic settings are correct and they are as I was able to hit the apache landing page prior to editing the conf and I am also able to ssh in and ping the IP, but I believe I am possibly having some issue with the config files. This is what I hit when I hit the endpoint:

enter image description here

enter image description here

My httpd is running and I was able to access the apache landing page prior to editing my config files.

Here is the main part of my httpd.conf (please note: I didn’t include the whole thing because it is massive and consists of mostly commented out code):

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/[project_path]/public"
#
# Relax access to content within /var/www.
#
<Directory "/var/www/[project_path]/public">
    AllowOverride All
    # Allow open access:
    Require all granted
</Directory>
# Further relax access to the default document root:
<Directory "/var/www/[project_path]/public">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All
    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ".ht*">
    Require all denied
</Files>

and here is my added project.conf file inside of conf.d:

<Directory "/var/www/[project_path]/public">
  AllowOverride All
  # Allow open access:
  Require all granted
</Directory>
# Further relax access to the default document root:
<Directory "/var/www/[project_path]/public">
  #
  # Possible values for the Options directive are "None", "All",
  # or any combination of:
  #  Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
  #
  # Note that "MultiViews" must be named *explicitly* --- "Options All"
  # doesn't give it to you.
  #
  # The Options directive is both complicated and important. Please see
  # http://httpd.apache.org/docs/2.4/mod/core.html#options
  # for more information.
  #
  Options Indexes FollowSymLinks
  #
  # AllowOverride controls what directives may be placed in .htaccess files.
  # It can be "All", "None", or any combination of the keywords:
  #  Options FileInfo AuthConfig Limit
  #
  AllowOverride All
  #
  # Controls who can get stuff from this server.
  #
  Require all granted
</Directory>
<Directory "/var/www/[project_path]/public">
        Options -Indexes
</Directory>
<VirtualHost hostIP:80>
        ServerName hostIP
        DocumentRoot /var/www/[project_path]/public
        TraceEnable Off
</VirtualHost>
ServerTokens Prod
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</IfModule>
<IfModule mpm_prefork_module>
    StartServers      50
    MinSpareServers     10
    MaxSpareServers     30
        ServerLimit       50
        MaxClients       50
        MaxRequestsPerChild   100
</IfModule>

Any help would be greatly appreciated!

2

Answers


  1. Chosen as BEST ANSWER

    Resolved this by adding an ssl.conf file along with a project.conf.bak in conjunction with the project.conf file


  2. Your RewriteEngine is redirecting port 80 to HTTPS which goes to port 443 which is not defined.

    If you want to run the server under port 80 (HTTP connection), remove the

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
    </IfModule>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search