Report this

What is the reason for this report?

How to use NGINX instead of Apache on DigitalOcean platform?

Posted on November 7, 2020

I believe I saw something whilst searching that you can use NGINX instead of Apache on a Web Service in the DigitalOcean App Platform by adding an nginx.conf file to the root of a project. Despite efforts searching, I can’t find it again, and there’s nothing in the documentation either that I can find.

I tried switching out:

heroku-php-apache2 public/

for:

heroku-php-nginx public/

But the build failed and rolled back. No idea why as the logs provide no more information other than to say it’s failed and rolled back.

In addition to running NGINX thought, as said, I’d also like to be able to have more granular control and the ability to customise the NGINX config. Is this possible?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

For the level of control you’re looking for, I’d recommend using a Dockerfile. You can find an example of a PHP Apache Dockerfile on the PHP Project’s Docker Hub page. To use a Dockerfile with App Platform, simply put the Dockerfile in the root of your github project before creating the App Platform app.

If you need to put the file in a subdirectory, or want to add a Dockerfile to an existing project, add the dockerfile_path parameter to your App Spec and apply the changes via doctl or the API.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.