[ckan-dev] CKAN + Wordpress

Shihoko Takahashi shihoko_t at icloud.com
Thu Feb 11 15:32:36 UTC 2016


Thank you Stefan for reply and sorry for late reply. Been trying different combination of config settings that I could think of but none work and hoping you have some more advice as I’m out of ideas.

I don’t necessarily need to use nginx but thought it would be good to cache with it, but I was using it because I managed to get more things working with nginx+apache rather than when I tried using apache alone. 

Following your advice, I have changed header setting for nginx and now I can log in/out.
Still having issues with editing user account profile and deleting resources or dataset etc - I get internal server error (but database is updated). 

I tried using Apache only again, with your hints but didn’t redirect to 127.0.0.1:8080.
Appreciate if you could check below apache conf. 

<VirtualHost *:80>
    ServerName ec2-xx-xx-xx-xx.ap-southeast-2.compute.amazonaws.com
    ServerAlias www.ec2-xx-xx-xx-xx.ap-southeast-2.compute.amazonaws.com
    DocumentRoot /var/www/html/wp
    <Directory "/var/www/html/wp">
        AllowOverride All
        Options FollowSymlinks
        Order allow,deny
        Allow from all
    </Directory>
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteRule ^((activity|api|base|ckan-admin|dataset|dashboard|fanstatic|feeds|group|harvest|images|licenses|login_generic|organization|package|packages|rating|related|resource|revision|search|storage|user|util)(.*))$ http://127.0.0.1:8080/$0 
    </IfModule>
</VirtualHost>

<VirtualHost 127.0.0.1:8080>
    ServerName ec2-xx-xx-xx-xx.ap-southeast-2.compute.amazonaws.com
    ServerAlias www.ec2-xx-xx-xx-xx.ap-southeast-2.compute.amazonaws.com
    WSGIScriptAlias / /etc/ckan/default/apache.wsgi

    # Pass authorization info on (needed for rest api).
    WSGIPassAuthorization On

    # Deploy as a daemon (avoids conflicts between CKAN instances).
    WSGIDaemonProcess ckan_default display-name=ckan_default processes=2 threads=15

    WSGIProcessGroup ckan_default

    ErrorLog /var/log/apache2/ckan_default.error.log
    CustomLog /var/log/apache2/ckan_default.custom.log combined
    LogLevel info

    <IfModule mod_rpaf.c>
        RPAFenable On
        RPAFsethostname On
        RPAFproxy_ips 127.0.0.1
    </IfModule>

    <Directory />
        Require all granted
    </Directory>
</VirtualHost>


Regards,
Shihoko



> 
> Date: Fri, 29 Jan 2016 17:41:15 +0100
> From: Stefan Oderbolz <stefan.oderbolz at liip.ch <mailto:stefan.oderbolz at liip.ch>>
> To: CKAN Development Discussions <ckan-dev at lists.okfn.org <mailto:ckan-dev at lists.okfn.org>>
> Subject: Re: [ckan-dev] CKAN + Wordpress
> Message-ID:
> 	<CAARrFXdBYPijT+hCG+Q3xAK0CxZFfs5DYVgr+9ECUhZQuuxc+A at mail.gmail.com <mailto:CAARrFXdBYPijT+hCG+Q3xAK0CxZFfs5DYVgr+9ECUhZQuuxc+A at mail.gmail.com>>
> Content-Type: text/plain; charset="utf-8"
> 
> I don't really know nginx, so unfortunately I can't verify your config. Is
> there a specific reason why you want to use nginx?
> 
> We have the same requirement (run both WordPress and CKAN on the same
> server), and we only use Apache with mod_rewrite and its proxy
> functionality.
> 
> This is our config:
> 
> # Redirect to CKAN server
> <IfModule mod_rewrite.c>
> RewriteEngine On
> RewriteRule
> ^((de/|en/|it/|fr/)?(packages|organization|package|dataset|group|resource|related|revision|licenses|rating|ckan-admin|user|login_generic|util|harvest|activity|dashboard|api|search|storage|feeds|fanstatic|images|base)(.*))$
> http://127.0.0.1:8080/$0 <http://127.0.0.1:8080/$0> [P]
> </IfModule>
> 
> So we run WordPress on Port 80 and CKAN on Port 8080, and some routes are
> then proxied to CKAN.
> I remember that we also had problems with the login (because CKAN redirect
> after the login). Make sure that the site_url is configured correctly.
> 
> Another thing you could try is to make nginx rewrite the headers to replace
> 127.0.0.1:8080 to the external address. With Apache you could do this like
> that:
> 
> Header edit Location ^http(\:\/\/127.0.0.1:8080.*)$ http$1
> 
> Maybe this helps you to find the right solution for nginx.
> 
> - Stefan
> 
> On Fri, Jan 29, 2016 at 7:39 AM, Shihoko Takahashi <shihoko_t at icloud.com <mailto:shihoko_t at icloud.com>>
> wrote:
> 
>> Hello,
>> 
>> Firstly, apologies if this is the wrong place to ask this, but I found an
>> old Q&A that is related (
>> https://lists.okfn.org/pipermail/ckan-dev/2013-September/005868.html <https://lists.okfn.org/pipermail/ckan-dev/2013-September/005868.html>), so
>> I am asking here rather than StackOverflow or Google group.
>> 
>> I am trying to run CKAN and Wordpress on the same server, same domain, on
>> port 80. Nginx is listening to port 80, and redirecting CKAN related
>> requests (/dataset /user etc) to Apache port 8080, and rest to Wordpress at
>> Apache port 8000. Most things are working fine, but some requests are
>> getting internal error or server not found - things that don?t work include
>> logging in/out with CKAN which seems to redirect itself.
>> 
>> My nginx setting is ?>
>> location / {
>>        proxy_pass http://127.0.0.1:8000 <http://127.0.0.1:8000/>;
>>        include /etc/nginx/proxy_params;
>>    }
>>    location ~*
>> ^/((activity|api|base|ckan-admin|dataset|dashboard|fanstatic|feeds|group|harvest|images|licenses|login_generic|organization|package|packages|resource|related|rating|search|storage|user)(.*))$
>> {
>>        proxy_pass http://127.0.0.1:8080/$1$is_args$args <http://127.0.0.1:8080/$1$is_args$args>;
>>        include /etc/nginx/proxy_params;
>>    }
>> 
>> Is it possible to redirect using Nginx like this? If there is there a
>> better/proper way to do this, can anyone give me any advise please? Thank
>> you in advance.
>> 
>> Regards,
>> Shihoko

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20160212/0c2aa3bb/attachment-0002.html>


More information about the ckan-dev mailing list