Thursday, August 22, 2013

Re: install cakephp with on a sub-domain

The first thing you should do when you get a 404 with Cake is to make sure debug is > 0. Cake throws a 404 on errors. Many, *many* people get tripped up and waste hours by this.

You should create a separate file in sites-available for each virtual host. Just remember to run a2ensite for each one, then "service apache2 reload".

Your <Directory> path should match DocumentRoot. And, because you have access tothe server's config, delete your .htaccess files. You don't need them because the path is set in the VirtualHost config. They just slow down apache, anyway. Set AllowOverride to "None".

<VirtualHost *:80>
  ServerName <url>.eu
  DocumentRoot /var/www/client/app/webroot
  ErrorLog /var/log/apache2/<url>.eu-error.log
  CustomLog /var/log/apache2/<url>.eu-access.log common

  <Directory /var/www/client/app/webroot>
    Options Indexes FollowSymlinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all

    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^(.*)$ index.php [QSA,L]
    </IfModule>
  </Directory>
</VirtualHost>

One minor correction: What you have here is not a subdomain, which would be of the form "eu.<url>".


On Fri, Aug 9, 2013 at 11:20 AM, gannher <g.lebozec@gmail.com> wrote:
I have one web server. I would like run 2 website on this server. 1 website with SPIP (already running good) and 1 website with cakephp (problem with it).

> SPIP => /var/www/vitrine/<spip_files>
> cakephp => /var/www/client/<cakephp_files>

The cakephp website is accessible by `client.<url>.eu` but when i go to this address, i have a 404 error. Can you say me why ? 

Here my /etc/apache2/sites-available/default :

    <VirtualHost *:80>
      ServerAdmin webmaster@localhost
     
      DocumentRoot /var/www/vitrine
      ServerName <url>.eu
      <Directory />
        Options FollowSymLinks
        AllowOverride All
      </Directory>
      <Directory /var/www/vitrine>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
      </Directory>
     
      ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
      <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
      </Directory>
     
      ErrorLog ${APACHE_LOG_DIR}/error.log
     
      # Possible values include: debug, info, notice, warn, error, crit,
      # alert, emerg.
      LogLevel warn
     
      CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
     
    <VirtualHost *:80>
     
      DocumentRoot /var/www/client/app/webroot
      ServerName client.<url>.eu
      <Directory /var/www/client>
        Options Indexes FollowSymlinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
      </Directory>
     
    </VirtualHost>


Here the /var/www/client/app/.htaccess :

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteBase /
        RewriteRule    ^$    webroot/    [L]
        RewriteRule    (.*) webroot/$1    [L]
    </IfModule>

Here the /var/www/client/app/webroot/.htaccess :

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ index.php [QSA,L]
    </IfModule>

Thanks :)

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: