Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nitsuj102284's avatar

Custom nginx install with Forge?

I have a few different servers that I would like to spin up with Forge. One of the server types is nginx compiled with modules, e.g. Nginx RTMP module. Is there any way to run a custom nginx install with Forge, or am I better off spinning up my own server outside of Forge for this instance? What would be best practice?

0 likes
4 replies
Cronix's avatar

Yes, this is what "recipes" are for (link at the very top of the forge panel). You can create a recipe, which is just a bash script, and have that run when creating the server. When you create the server, there is a "post-provision recipe" dropdown in the server settings section (like when you choose the type of server, php version, etc.), so you can just select the recipe you made there. So it will run that code after the server is created.

There's actually a forge recipe site that you can check to see if they already have what you're needing, or see how they create theirs as an example, etc. http://forgerecipes.com/

nitsuj102284's avatar

I did a check at that site a few minutes ago, and did not see one. So, is the recipe overwriting the nginx install made by Forge. Or is it telling Forge not to install nginx, "install mine instead"?

Cronix's avatar

No, they are post-provision scripts. It builds the server normally, and then you can alter it however you want, like uninstall the default nginx and install the one you want, or change the nginx config, or whatever you normally can do in a bash script (which is everything).

nitsuj102284's avatar

I know that this was asked several months ago, but I just now am getting back to it, and I really am not satisfied with simply removing the the forge Nginx install and compiling Nginx without using Forge as it is intended to be used.

The nginx install defaults to /usr/local/nginx, which works, but makes it to where I cannot edit the config file in Forge, and I cannot restart Nginx thru Forge. I tried the following (below), which allows me to see the config in Forge, but it does not properly install Forge in /etc/index.

./configure --prefix=/etc/nginx --sbin-path=/etc/nginx --builddir=/etc/nginx --conf-path=/etc/nginx/sites-available/default

I receive the following error when trying to "restart" Nginx in Forge: nginx.service is not active, cannot reload.

Any insight would be appreciated.

Please or to participate in this conversation.