Virtual Hosts apache ERR_CONNECTION_REFUSED

3

Could someone help me? I set up a virtualhost in Apache so that when I entered the address testsystem I was taken to the homepage of my system designed in laravel, but when I entered to this address the browser gives me the message that the website can not be accessed. The www.testsistema.com page rejected the connection. ERR_CONNECTION_REFUSED, but when entering www.testsistema.com:8000 it shows me the main page of xampp. My httpd-vhost file is configured as follows

<VirtualHost *:8000>
  DocumentRoot "C:/xampp/htdocs"
  ServerName localhost:8000
</VirtualHost>

<VirtualHost *:8000>
  DocumentRoot "C:/web/Sistema/public"
  ServerName www.testsistema.com
  <Directory "C:/web/Sistema/public"
    Require all granted
  </Directory>
</VirtualHost>

My httpd file is as follows:

#
# MaxRanges: Maximum number of Ranges in a request before
# returning the entire resource, or one of the special
# values 'default', 'none' or 'unlimited'.
# Default setting is to accept 200 Ranges.
#MaxRanges unlimited

#
# EnableMMAP and EnableSendfile: On systems that support it, 
# memory-mapping or the sendfile syscall may be used to deliver
# files.  This usually improves server performance, but must
# be turned off when serving from networked-mounted 
# filesystems or if support for these functions is otherwise
# broken on your system.
# Defaults: EnableMMAP On, EnableSendfile Off
#
#EnableMMAP off
#EnableSendfile off

# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be 
# included to add extra features or to modify the default configuration of 
# the server, or you may simply copy their contents here and change as 
# necessary.

# Server-pool management (MPM specific)
Include conf/extra/httpd-mpm.conf

# Multi-language error messages
Include conf/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
Include conf/extra/httpd-autoindex.conf

# Language settings
Include conf/extra/httpd-languages.conf

# User home directories
Include conf/extra/httpd-userdir.conf

# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Attention! WEB_DAV is a security risk without a new userspecific configuration for a secure authentifcation 
#Include conf/extra/httpd-dav.conf

# Various default settings
#Include conf/extra/httpd-default.conf
# Implements a proxy/gateway for Apache.
Include "conf/extra/httpd-proxy.conf"
# Various default settings
Include "conf/extra/httpd-default.conf"
# XAMPP settings
Include "conf/extra/httpd-xampp.conf"

# Configure mod_proxy_html to understand HTML4/XHTML1
<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>

# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
#       starting without SSL on platforms with no /dev/random equivalent
#       but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

# XAMPP: We disable operating system specific optimizations for a listening
# socket by the http protocol here. IE 64 bit make problems without this.

AcceptFilter http none
AcceptFilter https none
# AJP13 Proxy
<IfModule mod_proxy.c>
<IfModule mod_proxy_ajp.c>
Include "conf/extra/httpd-ajp.conf"
</IfModule>
</IfModule>

and my windows hosts file as follows:

127.0.0.1       localhost
::1             localhost

127.0.0.1 www.testsistema.com

Does anyone know if there is something that I need to configure or something I'm doing wrong?

    
asked by DianaCarolina30 07.11.2018 в 21:24
source

2 answers

1

This line should be commented on in the hosts file:

For Windows Vista or for Windows Server 2008

In the virtual host file you should remove the first virtual server that listens on port 8000 since apache finds that first one and derives the requests to that virtual host, that's why you see the xamp page:

<VirtualHost *:8000>
  DocumentRoot "C:/xampp/htdocs"
  ServerName localhost:8000
</VirtualHost>

On the other hand it was not clear to me in your question but if you do not want to put the :8000 in the url, you have to use the default HTTP port which is 80. That is, in the virtual host instead of 8000 You have to say 80.

To be able to use that port there does not have to be another server already listening there.

    
answered by 08.11.2018 в 03:25
0

For GNU / Linux

You must open the port of Apache2, it is located in the route:

/etc/apache2/ports.conf

You must add the port in the configuration in that file, it would be something like:

Listen 8000

Restart apache2:

sudo service apache2 restart

For Windows it varies a lot where the file ports.conf can be even can not be, if it is not in the httpd it adds the line:

Listen 8000

Ideal before you call the virtualhost, after this restart apache2

    
answered by 09.11.2018 в 15:52