Forums » SEPHP Help and Tips

Instant SocialEngine on NGINX with Modern DevOps

    • 18 posts
    December 4, 2018 8:48 PM EST

    Just in time for the holidays, I've put together a project which I hope will be a gift for everyone. I've already asked a number of dumb questions here and probably will ask more, so I'm contributing this back to the community... Enjoy! I've licensed social-nginx as open source through an Apache license. Feel free to use it.

    I had a number of objectives:

    1. I wanted to run SE on NGINX
    2. I wanted to store my SE implementation in a version-control system
    3. I wanted my site to be instantly reproducible, including test versions, branches, rollbacks, etc.
    4. I wanted to be able to instantly run it on a cloud server, or on my laptop
    5. I wanted to support modern DevOps and Continuous Integration / Delivery.
    6. I wanted it to be able to easily scale in a cluster

    The first goal (NGINX) isn't directly related to the others, but I can say that SE is noticeably faster on NGINX.

    The result is social-nginx. Social-nginx is a Docker container that is configured to run SocialEngine on NGINX with PHP-FPM. It knows how to quickly set up a local database for super fast, super easy development and testing- or use an existing database connection in production. By storing my entire SocialEngine site, including the database, in a Github repository it is instantly reproducible from any branch or version. (Note: social-nginx is a public project. My SocialEngine site, however, is a private repository because, of course, SE is a commercial product). Because this is a docker container, it runs in the exact same environment on my laptop that runs on a cloud server or a cluster. No surprises! No environment changes that are only made in one place! No one-off server changes that I don't remember, having to figure them out all over again when I change things later. Docker brings huge benefits to developing and operating a modern web application.

    It's still rough around the edges, but I have this working. I can easily and effortlessly create a feature branch, launch my SE site on my laptop, make my changes (including adding plugins or themes), push changes to version control and test the changes in the cloud, then merge the branch into my main branch and redeploy my production server (there is still some work to fully automate everything, but I'm working on that). I can also give contract developers access, let them make changes in isolation, and review and test their changes before merging and deploying using the same workflow.

    In the Github repo, I've posted full instructions for testing this out yourself. Let me know what issues you encounter, or if you find this useful.

    Check it out!



    This post was edited by Donna at December 5, 2018 5:13 AM EST
    • 67 posts
    December 4, 2018 9:09 PM EST

    Off to a good start!

    We use GitHub to push changes also to production servers also and a few other DevOps tools for our separate clusters. You have made a great contribution here!

    • Moderator
    • 5073 posts
    December 5, 2018 5:14 AM EST

    Thanks for the post. We do have improvements coming for the development process as mentioned in your other thread. 

    I'm sure your GitHub will be helpful to others. Thank you for not including SE files in it. :)

    This post was edited by Donna at December 5, 2018 6:09 AM EST
    • 287 posts
    December 5, 2018 11:34 AM EST
    This is exciting.
    • 18 posts
    December 5, 2018 3:06 PM EST

    I just noticed the URL rewriting in the NGINX config isn't working - I must have changed something that affected that. I'll fix that!

    • 287 posts
    December 5, 2018 3:30 PM EST

    Not sure whether you want questions here or on the git. 


    step 14 when you mention copying the template out of /social-engine/site-template  , is this to the projects folder created in step 12 ? 


    is also step 15 and 16 to be extracted to step 12 folder? 



    • 18 posts
    December 5, 2018 4:05 PM EST

    This is copying to the socialengine folder inside the project folder, creating a skeleton directory that is expected by the other parts of the script.

    So using the directory names I had it is the same as

    cp -R ~/se-nginx-test/social-nginx/site-template/. ~/se-nginx-test/socialengine/

    I was just using relative directories based on the current directory from the previous steps.

    • 18 posts
    December 5, 2018 11:08 PM EST

    I've updated the git repository (and docker image) with a few updates- primarily fixing the NGINX URL rewrite rules that stopped working.

    I've taken a narrow approach- most NGINX conf files for SE I've found are flexible about allowing external calling of PHP files. I've taken a different approach- I don't allow external calling of php files except where SE makes those calls. Currently I've only found one case of this- SE pages (or maybe my them) call css.php directly. So I carved out an exception for that. 

    So if something isn't working, and google dev tools how that you're getting a 404 on some php file, let me know and I can edit the nginx-site.conf to allow it.

    • 1 posts
    June 11, 2020 4:52 PM EDT

    New to SE and haven't done my install setup yet. I was wondering if anyone has this working:

    Instant SocialEngine on NGINX with Modern DevOp

    I'm looking to install SE to run fully on NGINX. Also, noticed Eric github link is broken or not available. Appreciate any feedback.

    • Moderator
    • 5073 posts
    June 12, 2020 4:48 AM EDT

    Just note that this will not be supported by SE so if you need support, you wouldn't be able to get it from SE as the SEPHP script doesn't work on Nginx without tweaks and is not officially supported. BryZar, our recommended host, has it on Nginx by proxy which is fine.

    • 164 posts
    June 12, 2020 9:33 AM EDT
    paulev said:

    New to SE and haven't done my install setup yet. I was wondering if anyone has this working:

    Instant SocialEngine on NGINX with Modern DevOp

    I'm looking to install SE to run fully on NGINX. Also, noticed Eric github link is broken or not available. Appreciate any feedback.


    The github link went down mid-late last year. I just had a look through github and found this repo which contains it.


    Earlier this year, I used the docker image image available here for some testing. I eventually decided to use OpenLiteSpeed as the back end for my site, although I am going to let it run for six months before deciding whether or not this will be permanent.


    If I remember correctly, additional config needs to be added to implement the .htaccess rules that SocialEngine relies on to prevent files that should be accessible to not be accessible.


    Due to the way nginx is configured in social-nginx, it is likely it will need updating to function with SocialEngine 5.x due to the way the mobile apps are implemented.

    This post was edited by abuk at June 12, 2020 9:34 AM EDT
    • 73 posts
    July 28, 2020 3:45 AM EDT

    Has this project been discontinued?
    It is now a very nice project.
    I hope it will continue.


    Happy SE

    This post was edited by Lee KiWon at July 28, 2020 3:45 AM EDT