简体   繁体   中英

apache vhost config for Phalcon

I have problems with vhost configuration for my phalcon app. I want localhost address to be pointed to var/www/html/public .

<VirtualHost *:80>

ServerAdmin admin@example.host
DocumentRoot "/var/www/html/public"
DirectoryIndex index.php
ServerName localhost
ServerAlias localhost

<Directory "/var/www/html/public">
    Options All
    AllowOverride All
    Allow from all
</Directory>

<Directory "/var/www/html">
    Options All
    AllowOverride All
    Allow from all
</Directory>

</VirtualHost>

When I go to localhost I see "Mod-Rewrite is not enabled" but when I type localhost/public it goes into public catalog which I want to be root .

When you create your project with Phalcon Dev Tools , an .htaccess file will be created in root of your project instead of /public directory and the content of it is equal to :

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

So first you must change the DocumentRoot to:
/var/www/html
Then add the above code in your .htaccess file.

I recommend you to use PhalconDevTools for better experience & result.

GoodLuck

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