所以我有Ubuntu12.04(桌面版),我想为a.localhost设置一个虚拟主机。我知道如何设置sites-enabled和/etc/hosts。我还没有弄清楚的是,如何将虚拟主机定向到/home/aubrey/a.project,并将/home/aubrey/a.project/b链接到/home/aubrey/Project A/b,并能够使用http://a.localhost/b访问所有这些虚拟主机
另一种解释:
具有讽刺意味的是,我在Windowz和xampp上做得很好。我只希望能够将插件代码保存在主文件夹的存储库中,并将WordPress安装在/home/aubrey/a-wordpress之类的位置,并将/home/plugin-project/plugin-a链接到/home/aubrey/a-wordpress/wp-content/plugins/plugin-a。
发布于 2012-08-21 07:48:47
这个问题是否适用于插件目录中的所有文件?特别是像CSS或JS这样的静态文件?或者这个问题只出现在PHP文件中?
如果只是PHP文件,请检查您的PHP配置。也许您在那里配置了open_basedir?
发布于 2012-08-21 08:05:50
如果我没记错的话,你要的是+SymLinksIfOwnerMatch,而不是-SymLinksIfOwnerMatch。-表示不允许该指令,而+则表示打开该指令。但这里肯定有可能是其他原因导致的问题。
发布于 2012-08-21 12:58:35
好的,这就是我所做的让事情变得正常:
首先,启用userdir
sudo a2enmod userdir
然后,编辑/etc/apache2/mods-enabled/php5.conf
<IfModule mod_php5.c>
<FilesMatch "\.ph(p3?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
#php_admin_value engine Off
</Directory>
</IfModule>
</IfModule>请注意,我注释掉了php_admin_value以允许使用PHP。
然后,创建一个虚拟主机:
<VirtualHost *:80>
ServerName philknight.localhost
DocumentRoot /home/aubrey/public_html/philknight-wordpress
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /home/aubrey/public_html/philknight-wordpress>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>而且,在/home/aubrey/public_html/philknight-wordpress中,我可以在我的主文件夹中的其他地方创建到wp-content的链接,确切地说,是/home/aubrey/Documents/Projects & Companies/Excion/Metz Tennis/PhilKnight/wp-content/themes/philknight。我使用了常见的SHIFT_CTRL拖动方法,但我确信ln -s也会起作用。
希望这对任何人都有帮助,如果你有问题请留言…
权限:
drwxrwxrwx 4 www-data www-data 4096 Aug 20 18:46 /home/aubrey/public_html
drwxrwxrwx 8 aubrey aubrey 4096 Aug 20 21:11 /home/aubrey/Documents/Projects & Companies/Excion/Metz Tennis/PhilKnight/wp-content
我还必须使用chmod 777 -R /home/aubrey/Documents/Projects & Companies/Excion/Metz Tennis/PhilKnight/wp-content/plugins和/home/aubrey/Documents/Projects & Companies/Excion/Metz Tennis/PhilKnight/wp-content/themes
https://stackoverflow.com/questions/12046687
复制相似问题