简体   繁体   中英

Unable to connect to apache virtualhost

I have unizped codeigniter on /var/www/control_cuotas indx.php is placed on that folder and I settrd up a new virtualhost on apache on the 000-default.conf file whith this code

<VirtualHost *:81>

        <Directory /var/www/control_cuotas>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Require all granted
        </Directory>

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/control_cuotas
        ServerAlias www.control_cuotas.test


        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined


</VirtualHost>

But I cannot acces to localhost:81 its Unable to connect and the serve rwas restarted before I tried to access

For example:

<VirtualHost *:80>
  ServerName your_project
  DocumentRoot "C:/wamp64/www/your_project"
  <Directory "C:/wamp64/www/your_project/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>

Let's try one more time.

Make sure all your VirtualHosts define a ServerName. Failure to do so will mean trouble as you add more hosts.

<VirtualHost *:80>
    DocumentRoot /var/www/control_cuotas
    ServerName control_cuotas.test
    ServerAlias www.control_cuotas.test
    ServerAdmin webmaster@localhost

    <Directory /var/www/control_cuotas>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Don't forget to enable the above config in Apache adding it to the sites-enabled list. Then restart Apache.

The file /etc/hosts should look like this at a minimum

127.0.0.1   localhost
127.0.0.1   control_cuotas.test
127.0.0.1   www.control_cuotas.test

Other VHosts should also be represented in this file.

You can also add entries for ipV6 if you want, but it is not a requirement in most cases. (The main case is that you have disabled communication using ipV4.)

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