0

Hi i've tried to configure a vhost on my server but it's not working.

when trying to access it goes default...

this is my basic config.

On my server:

/var/www/html/blentico.com/public_html/index.php (and Wordpress packages)

/etc/apache2/sites-available/blentico.com.conf

this is the content of blentico.com.conf

<VirtualHost *:80>
ServerAdmin admin@blentico.com
ServerName blentico.com
Serveralias www.blentico.com
DocumentRoot /var/www/html/blentico.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

then i run the command:

a2ensite blentico.com.conf

all my files/directories inside /var/www have user/group root and 755 permission

ok, so, i suppose that this is OK according to all the docs i've read but when i try to access to www.blentico.com it goes directly to my index.php file located in /var/www/html/index.php and no to /var/www/html/blentico.com/public_html as i've indicated on my blentico.com.conf file.

hope you can help me.

1
  • Post your solution as an answer, please, not as an edit to your question. – EEAA Jul 16 '16 at 2:22
0

At the very least you need to wrap your configuration with <VirtualHost></VirtualHost> tags. Otherwise I imagine it'll just get merged into the default configuration. See https://httpd.apache.org/docs/2.4/vhosts/ for more information on setting up vhosts.

1
  • Sorry about that , forgot to copy that. the file already had < VirtualHost * : 80> Now I edit the text – Juan Jul 16 '16 at 0:37
0

Done!

My default config (000-default.conf) were active and with no ServerName so always ended in this DocumentRoot (DocumentRoot of 000-default.conf file), right? i think yes cos when i deactivate this config with a2dissite 000-default and restart apache my config start working. i've also made some modifications to my config file although that doesn't make any difference to my first problem. Anyway i show it below

<VirtualHost *:80>

    ServerAdmin admin@blentico.com
    ServerName blentico.com
    Serveralias www.blentico.com
    DocumentRoot /var/www/html/blentico.com/public_html

    ErrorLog /var/log/apache2/blentico.com-error.log
    CustomLog /var/log/apache2/blentico.com-access.log combined

    <Directory /var/www/html/blentico.com/public_html>
            Order allow,deny
            allow from all
    </Directory>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.