【问题标题】:Laravel 5 and Wordpress 4.1.1 in the same serverLaravel 5 和 Wordpress 4.1.1 在同一个服务器上
【发布时间】:2015-03-28 11:23:57
【问题描述】:

这是我第一次尝试这个,经过一天的尝试,我被卡住了。我对 Ubuntu 没有太多经验,所以也许我错过了一些明显的东西。

我正在尝试将 WP(最新)和 Laravel 5 安装到 Virtual Box 中的 Ubuntu 14.04 安装中。我希望两者并肩工作,因为 WP 将负责网站方面的工作,而网络应用程序将基于 Laravel 5。

结果是 Wordpress 工作正常,但是当我转到 http://domain.com/app 时,我得到一个空白页和臭名昭著的 500 错误:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

我错过了什么。谢谢!

目录结构:

/etc/var/www/public_site - Public web site (WordPress is installed here)

/etc/var/www/ (Laravel 5 installed here)

/etc/var/www/public_site/wp-admin, 
                         wp-content, 
                         wp-includes  
                         app (as Laravel public folder)

在阅读了多个论坛帖子后,这是我所做的:

/public_site/ 中的.htaccess 包含:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/app [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

/public_site/app 中的.htaccess 包含:

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

/etc/apache2/sites-enabled/000-default.conf(同样适用于可用站点)

<VirtualHost *:80>
        ServerName 10.0.0.204
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/public_site

        <Directory /var/www/>
                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>

【问题讨论】:

    标签: php wordpress apache .htaccess


    【解决方案1】:

    我认为最好的解决方案是将它们安装在单独的文件夹中。

    例如:

    /etc/var/wordpress
    

    /etc/var/laravel
    

    然后,主域将指向/etc/var/wordpress 您可以创建一个指向 laravel 的子域,例如:

    domain.com      --> /etc/var/wordpress
    app.domain.com  --> /etc/var/laravel
    

    我认为您不应该将它们安装在同一个文件夹中,这将使维护成为一场噩梦

    【讨论】:

    • 我必须同意这里。我的印象是这是两个相似但不同的代码库。对吗?
    • Wordpress 和 Laravel 肯定是不同的代码库 :)
    • 是的。我不确定他是不是想用框架做一些 frankensteiny 的事情并且有点害怕。
    • @David S,别害怕!我想我已经做到了!谢谢@dynamic!
    猜你喜欢
    • 2016-02-29
    • 2016-12-17
    • 1970-01-01
    • 2019-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-31
    • 1970-01-01
    相关资源
    最近更新 更多