简体   繁体   中英

apache virtual host not working for laravel app on digitalocean IP

I have create virtual host, but not working I am using digitalocean IP

    <VirtualHost *:80>

    ServerName  ip/laravelblog    
    ServerAlias www.ip/laravelblog

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/laravelblog/public

    #/etc/apache2/sites-available/laravelbog.conf
    <Directory /var/www/html/laravelblog/public>
             Options Indexes FollowSymLinks MultiViews
               AllowOverride All
              Order allow,deny
            allow from all

    </Directory>

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

000-default.conf is also enabled and laravelblog also.

my url is ip/laravelblog ( I am using digitalocean IP). when I access my url (ip/laravelblog). its show all laravel folder. I need to point direct public folder.

I have solved the problem.

<VirtualHost *:80>
  #ServerName 
  ServerAlias IP
  Alias /project1 /var/www/html/project-path/public
  Alias /project2 /var/www/html/project-path/public     
  DocumentRoot /var/www/html
 <Directory "/var/www/html/>
   AllowOverride all
   Order allow,deny
   Allow from all
 </Directory>
 </VirtualHost>

the url will be IP/project1 for other project IP/project2

So you can add more and more Alias on one IP

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