开发者

Apache configuration for Symfony website with virtual hosts

开发者 https://www.devze.com 2023-01-06 17:27 出处:网络
I\'m trying to configure my local Apache2 server to host several Symfony websites using virtual hosts, but I just can\'t make it to alias lib/vendor/symfony/data/web/sf directory as /sf. I see that us

I'm trying to configure my local Apache2 server to host several Symfony websites using virtual hosts, but I just can't make it to alias lib/vendor/symfony/data/web/sf directory as /sf. I see that using %1 and %2 in alias statement is the source of the problem, but I can't find the right solution. I added to /etc/hosts entry 127.0.0.1 jobeet.sandbox.sfdevel, I created in my home directory directory ~/Projekty/sandbox/jobeet. My Apache2 site configuration reads as follows:

<VirtualHost *:80>
        ServerName localhost
        ServerAlias *.sfdevel
        VirtualDocumentRoot /home/alef/Projekty/%2/%1/开发者_开发技巧web

        <Directory /home/alef/Projekty/%2/%1/web>
                AllowOverride All
                Allow from All
        </Directory>

        Alias /sf /home/alef/Projekty/%2/%1/lib/vendor/symfony/data/web/sf
        <Directory /home/alef/Projekty/%2/%1/lib/vendor/symfony/data/web/sf>
                AllowOverride All
                Allow from All
        </Directory>

        ErrorLog /var/log/apache2/sfdevel_error.log
        LogLevel warn
        CustomLog /var/log/apache2/sfdevel_access.log combined

</VirtualHost>

When I change /home/alef/Projekty/%2/%1/lib/vendor/symfony/data/web/sf to /home/alef/Projekty/sandbox/jobeet/lib/vendor/symfony/data/web/sf it works just fine, but I want to use several separate Symfony websites. What changes should I include in my Apache2 configuration?


I'm not sure if you can create aliases this way. There's nothing about it in the apache documentation.

I'd think about removing Alias from your virtualhost definition anyway. Symbolic link will work the same:

cd /home/alef/Projekty/sandbox/jobeet/web
ln -s ../lib/vendor/symfony/data/web/sf
0

精彩评论

暂无评论...
验证码 换一张
取 消