简体   繁体   中英

Site deployment connection refused for Laravel Project hosted on EC2 instance

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:

在此处输入图像描述

在此处输入图像描述

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!

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>

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM