0

first I copy 000-default.conf

cp 000-default.conf demo

then I link demo in site-avaible

ln -s ../sites-available/demo demo

here is my 000-default.conf I want to set project run in www.example.com

<VirtualHost *:80>
     ServerName example.com
     ServerAlias demo.example.com/
     DocumentRoot /var/www/html/test/
     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combin
    </VirtualHost>

here is my demo file I want to project run in demo.example.com

<VirtualHost *:80>
 ServerName www.example.com
 DocumentRoot /var/www/html/main/public
 ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined
 <Directory /var/www/html/main/public>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
        </Directory>
</VirtualHost>

after that I run service apache2 restart I can enter in www.example.com only but I cant enter to demo.example.com . I'm not sure what I'm doing wrong

1 Answer 1

2

So a few minor things I feel the need to say - First, I would always leave .conf on copied files. Second, I would always use a2ensite and a2dissite to enable and disable any sites.

I would also disable the default site in this case if you are using the example.com domain name. If your default site is not currently enabled, that would be why you can't access demo.example.com - if you're looking to access that site, you'll need to enable it by running a2ensite 000-default

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.