# Nginx apache and port

**URL:** <https://www.ruby-forum.com/t/nginx-apache-and-port/189205>\
**Category:** NGINX\
**Created:** [May 26, 2010, 7:21pm UTC](https://www.ruby-forum.com/t/nginx-apache-and-port/189205 "2010-05-26T19:21:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JCR](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/258eb7/32.png) [@JCR](https://www.ruby-forum.com/u/JCR)\
**Post date:** [May 26, 2010, 7:21pm UTC](https://www.ruby-forum.com/t/nginx-apache-and-port/189205/1 "2010-05-26T19:21:32Z")

</div>

Hello,

I have a centos 5 box with apache running fine and listening to port 80.  
I’d like to try nginx on let’s say port 5080 (or maybe there is a better  
port), without disturbing my apache setup.

(1) If I compile nginx from source and do nothing, will my apache setup  
be disturbed?

(2) I am thinking that all the work to make sure nginx listens to port  
5080 is to be done in the nginx.conf file; is that right?

Thanks

Posted at Nginx Forum:

> **[nginx apache and port](https://forum.nginx.org/read.php?2,90556,90556#msg-90556)**
>
> Hello, I have a centos 5 box with apache running fine and listening to port 80. I'd like to try nginx on let's say port 5080 (or maybe there is a better port), without disturbing my apache setup. (1) If I compile nginx from source and do nothing,...

---

<div class="post-metadata">

**Author:** ![JCR](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/258eb7/32.png) [@JCR](https://www.ruby-forum.com/u/JCR)\
**Post date:** [May 26, 2010, 7:29pm UTC](https://www.ruby-forum.com/t/nginx-apache-and-port/189205/2 "2010-05-26T19:29:44Z")

</div>

Your (2) answers your (1), and so would searching for the answer:  
[http://wiki.nginx.org/NginxHttpCoreModule#listen](http://wiki.nginx.org/NginxHttpCoreModule#listen)

–  
() ascii-rubanda kampajno - kontraÅ­ html-a retpoÅto  
/\ ascii ribbon campaign - against html e-mail

---

<div class="post-metadata">

**Author:** ![JCR](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/258eb7/32.png) [@JCR](https://www.ruby-forum.com/u/JCR)\
**Post date:** [May 26, 2010, 7:36pm UTC](https://www.ruby-forum.com/t/nginx-apache-and-port/189205/3 "2010-05-26T19:36:46Z")

</div>

Hi,

Â

If you don’t run it as a superuser, Nginx cannot listen on port 80 and  
therefore not intervene with your Apache. Also, compiling and running as  
superuser while Nginx is configured to listen at port 80 will not  
intervene with Apache as long as Apache was already running, only one  
process can claim a port at the same time.

Â

I suggest you compile from source, deploy the binary and configurations  
and configure Nginx to run at port 8080, which many people do. Can’t be  
a problem.

Â

Cheers,  
Â  
-----Original message-----  
From: JCR [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Wed 26-05-2010 19:27  
To: removed\_email\_address@domain.invalid;  
Subject: nginx apache and port

Hello,

I have a centos 5 box with apache running fine and listening to port 80.  
I’d like to try nginx on let’s say port 5080 (or maybe there is a better  
port), without disturbing my apache setup.

(1) If I compile nginx from source and do nothing, will my apache setup  
be disturbed?

(2) I am thinking that all the work to make sure nginx listens to port  
5080 is to be done in the nginx.conf Â file; is that right?

Thanks

Posted at Nginx Forum:

> **[nginx apache and port](https://forum.nginx.org/read.php?2,90556,90556#msg-90556)**
>
> Hello, I have a centos 5 box with apache running fine and listening to port 80. I'd like to try nginx on let's say port 5080 (or maybe there is a better port), without disturbing my apache setup. (1) If I compile nginx from source and do nothing,...

* * *

nginx mailing list  
removed\_email\_address@domain.invalid  
[http://nginx.org/mailman/listinfo/nginx](http://nginx.org/mailman/listinfo/nginx)

---

<div class="post-metadata">

**Author:** ![JCR](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/258eb7/32.png) [@JCR](https://www.ruby-forum.com/u/JCR)\
**Post date:** [May 26, 2010, 9:19pm UTC](https://www.ruby-forum.com/t/nginx-apache-and-port/189205/4 "2010-05-26T21:19:12Z")

</div>

> **[CommandLine | NGINX](https://www.nginx.com/resources/wiki/start/topics/tutorials/commandline/)**
>
> This tutorial shows you how to start, stop, and control NGINX from the command line.

What you suggested actually kills the server then starts it. It would  
be wiser to just reload the config file on the fly, without any  
downtime, by sending it signal 15:

kill -HUP `cat /var/run/nginx.pid`

This is on Debian GNU/Linux, YM[and pid location]MV.

–  
() ascii-rubanda kampajno - kontraÅ­ html-a retpoÅto  
/\ ascii ribbon campaign - against html e-mail

---

<div class="post-metadata">

**Author:** ![JCR](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/258eb7/32.png) [@JCR](https://www.ruby-forum.com/u/JCR)\
**Post date:** [May 26, 2010, 9:13pm UTC](https://www.ruby-forum.com/t/nginx-apache-and-port/189205/5 "2010-05-26T21:13:21Z")

</div>

Hello,

Thank you very much for your answer. I have both apache and nginx  
running at the same time with no disturbance. Excellent!

One thing I am still very confused about is how changes to the  
configuration file are captured. With apache, I do an apachectl -k  
graceful. Here from what I have read I should:

kill `cat /usr/local/nginx/logs/nginx.pid`

then

/usr/local/nginx/sbin/nginx

Is that right? Is there more to know?

Posted at Nginx Forum:

> **[Re: nginx apache and port](https://forum.nginx.org/read.php?2,90556,90604#msg-90604)**
>
> Hello, I have a centos 5 box with apache running fine and listening to port 80. I'd like to try nginx on let's say port 5080 (or maybe there is a better port), without disturbing my apache setup. (1) If I compile nginx from source and do nothing,...

---

<div class="post-metadata">

**Author:** ![JCR](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/258eb7/32.png) [@JCR](https://www.ruby-forum.com/u/JCR)\
**Post date:** [May 26, 2010, 9:22pm UTC](https://www.ruby-forum.com/t/nginx-apache-and-port/189205/6 "2010-05-26T21:22:08Z")

</div>

Hi,

Â

You can reconfigure Nginx on the fly [1]. Check the wiki on this  
subject.

[1]:Â [CommandLine | NGINX](http://wiki.nginx.org/NginxCommandLine)

Â

Cheers,

Â  
-----Original message-----  
From: JCR [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Wed 26-05-2010 21:17  
To: removed\_email\_address@domain.invalid;  
Subject: Re: nginx apache and port

Hello,

Thank you very much for your answer. I have both apache and nginx  
running at the same time with no disturbance. Excellent!

One thing I am still very confused about is how changes to the  
configuration file are captured. With apache, I do an apachectl -k  
graceful. Here from what I have read I should:

kill `cat /usr/local/nginx/logs/nginx.pid`

then

/usr/local/nginx/sbin/nginx

Is that right? Is there more to know?

Posted at Nginx Forum:

> **[Re: nginx apache and port](https://forum.nginx.org/read.php?2,90556,90604#msg-90604)**
>
> Hello, I have a centos 5 box with apache running fine and listening to port 80. I'd like to try nginx on let's say port 5080 (or maybe there is a better port), without disturbing my apache setup. (1) If I compile nginx from source and do nothing,...

* * *

nginx mailing list  
removed\_email\_address@domain.invalid  
[http://nginx.org/mailman/listinfo/nginx](http://nginx.org/mailman/listinfo/nginx)
