Can I run wordpress in the same VPS with a second IP?

Hi.

I know it is recommended to run discourse on it’s own server but I am running this project out of my own pocket, and it is basically a hobby with little prospects or intention of monetization in the short term at least.

So I was thinking instead of buying another VPS to to just request a second IP and run wordpress on a IP-based Apache virtual server, which would help keep costs low.

Is this doable or is it discouraged?

If you are familiar with reverse proxy configuration, you don’t need the second IP.

You can run both Discourse and Wordpress listening on unix sockets (or higher ports) and run a reverse proxy software in front (I recommend Caddy) to serve on the same IP your blog.example.com and forum.example.com.

That said, if you aren’t familiar with this type of setup, running each in it’s own VPS is much easier as you can just follow the vast documentation for each.

Can that setup you recommend work without issues?

I did something with haproxy when I was initially trying discourse. I was somewhat of a noob and still am in matters of servers and stuff but did anyway, and learned a bit about haproxy in the process. If I recall correctly there were issues with SSL, and the behavior of discourse whas somewhat inestable but guess I did I do something wrong.

So my question is it possible to do the configuration you recommend without instability and “funny” issues, without extreme amounts of fine tuning?

Yes, if you properly configure you reverse proxy it is possible. That is how this site right here is run.

What we can’t do is offer support to every reverse proxy configuration here.

Awesome!

Last petition: can you link me to some help documentation to do this configuration?

Nginx Run other websites on the same machine as Discourse

Caddy Use Caddy instead of NGINX as your reverse proxy

Apache Set up Discourse on a server with existing Apache sites

Lovely.

I remember when I did my trials I followed the apache guide. What is nor clear from the article is whether SSL should be disabled upon rebuilding discourse (and whether disabling it is accomplished by just not entering an email address for let’s encrypt), and what ports should be “exposed” on discourse/app.yml (the guide only shows who the line …

“8888:80” # fwd host port 8888 to container port 80 (http)

… is supposed to look, but nothing about the immediately following line in the app.yml file (the one than by default looks…

  • “443:443” # https

… should look like.

PS. While looking at the app.yml file to write that post I realized the following lines are present there:

##Uncomment these two lines if you wish to add Lets Encrypt (https)

  • “templates/web.ssl.template.yml”
  • “templates/web.letsencrypt.ssl.template.yml”

… however, as of right now, my discourse app is running with SSL enabled but with these likes uncommented. How crucial commenting these lines is for my current setup (without a proxy) or for my desired setup (with a proxy and apache-wordpress)?

:slight_smile:

If you are not familiar with reverse proxies, and you can get a second IP easily, then that’s not a bad solution. Just do something like this:

expose:
  - "192.168.1.1:80:80"   # http
  - "192.168.1.1:443:443" # https

This did it.

Love.
.

You can do the same trick with Configure direct-delivery incoming email for self-hosted sites with Mail-Receiver.

감사합니다. 이 방법으로 해결되었습니다. 제 VPS 제공업체는 VPS에 설정된 메인 IP 외에 저렴한 "플로팅 IP"도 제공합니다. 이 솔루션은 제게 매우 깔끔합니다. 이렇게 간단한 내용인데 더 잘 문서화되었으면 좋겠습니다.

expose:
   - "my_floating_ip:80:80"
   - "my_floating_ip:443:443"

그렇게 되셨나요? 드롭렛이 플로팅 IP에 대해 알 수 있을 거라고는 생각하지 못했어요.

잘 작동합니다:

먼저 플로팅 IP를 구매하고 VPS에 연결합니다.
그 다음 서버를 설정하여 해당 IP를 사용하도록 합니다:

vim /etc/network/interfaces.d/60-my-floating-ip.cfg

auto eth0:1
iface eth0:1 inet static
    address your.Float.ing.IP
    netmask 32

그리고 저장합니다. 네트워크를 재시작합니다:

sudo service networking restart

이제 IP가 2개가 있습니다: 메인 IP를 사용하여 여러 nginx 사이트를 설정합니다. /etc/nginx/sites-enabled 설정 라인을 참고하세요:

listen my_main_IP:80 myserver.name;
listen my_main_IP:443 ssl http2 myserver.name;

그리고 플로팅 IP는 /var/discourse/containers/app.yml에 다음과 같이 설정합니다:

expose:
   - "my_floating_ip:80:80"
   - "my_floating_ip:443:443"

모든 것이 정상인지 확인합니다 (원본 IP는 floating_ip와 main_ip로 수정됨):

# netstat -taunp | grep -i listen
tcp        0      0 floating_ip:80      0.0.0.0:*               LISTEN      19775/docker-proxy  
tcp        0      0 main_ip:80          0.0.0.0:*               LISTEN      13151/nginx: master 
tcp        0      0 0.0.0.0:22          0.0.0.0:*               LISTEN      725/sshd            
tcp        0      0 floating_ip:443     0.0.0.0:*               LISTEN      19763/docker-proxy  
tcp        0      0 main_ip:443         0.0.0.0:*               LISTEN      13151/nginx: master 
tcp6       0      0 :::22                      :::*                    LISTEN      725/sshd       

이름을 공개하는 것이 괜찮을지 모르겠지만, 서버는 Hetzner Cloud에 있으며 플로팅 IP 기능은 매우 편리하고 가격도 적절합니다.

아! 그렇게 할 수 있다는 걸 몰랐네요!

이 트릭을 사용하여 여러 도메인에 대한 여러 수신 메일 서버를 실행할 수도 있습니다.

잘하셨네요!

아! 그래서 어떻게 작동하는지 몰랐던 거군요.

이 주제는 오래되었지만, 여러분께 감사의 말씀을 드리고 싶었습니다. 제가 현재 다루고 있는 유사한 문제에서 며칠에 걸친 작업을 절약할 수 있을 것 같습니다. 이렇게 귀중한 정보를 공유해 주셔서 정말 감사합니다!!