TryHard
TryHard

Reputation: 299

How to setup apache with 2 laravel project

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

Upvotes: 0

Views: 65

Answers (1)

Grant Stromgren
Grant Stromgren

Reputation: 111

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

Upvotes: 2

Related Questions