Change nginx port globally

Hello.

I’ve searched the forum for a long time now, but I don’t get to find my answer.

I need my Nignx to run on an alternate port, instead of 80 (81, e.g.). I’d like it to be server-wide, in order to the next servers (to be created) also listen on the same alternate port.

I know I can edit the domain.conf file and add to the server block something like:

listen 81

However, any change on the site (like ee site update domain.com --hhvm) would break my custom config.

Any ideas?

Thanks in advance,

Janio

As you said, custom changes get overwritten in case of updates, this would need to be done at the core of EE.

Nice to see you around :stuck_out_tongue:

Nice to see you, Angel! :smiley:

I decided to ask here because I think (I’m not 100% sure) I’ve read somewhere that EE uses template files (.tpl) to create the vhosts.

In such case, it would kinda easy to maintain ONE template file, in case of upgrades.

Thanks for taking time to answer, sweetie. :slight_smile:

Really, no suggestions from admins? :frowning:

@janiosarmento

If you want custom port for your nginx, then the best way is to add listen 81; in file located at say /var/www/example.com/conf/nginx/custom.conf so that it will not be affected by ee site update command.

Great idea!

I should have figured it myself, so obvious after solved. :slight_smile:

Thanks a lot!