# Setting up nginx for use with Discourse

**URL:** https://meta.discourse.org/t/setting-up-nginx-for-use-with-discourse/21656
**Category:** Self-hosting
**Tags:** hosting
**Created:** [2014 年10 月 29 日 21:33 UTC](https://meta.discourse.org/t/setting-up-nginx-for-use-with-discourse/21656 "2014-10-29T21:33:34Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### 作者： ![nickharambee](https://avatars.discourse-cdn.com/v4/letter/n/53a042/32.png) [@nickharambee](https://meta.discourse.org/u/nickharambee)
#### 发布日期： [2014 年10 月 29 日 21:33 UTC](https://meta.discourse.org/t/setting-up-nginx-for-use-with-discourse/21656/1 "2014-10-29T21:33:34Z")

</div>

I am trying to install Discourse for a domain on a CentOS server. I think I have installed all of the necessary components by following this guide:

> **[How To Install Discourse on a CentOS 6.4 x64 VPS | DigitalOcean](https://www.digitalocean.com/community/tutorials/how-to-install-discourse-on-a-centos-6-4-x64-vps)**
>
> Here’s how to install Discourse on a CentOS 6.4 x64 VPS.

However, I am not sure what I need to enter in /etc/nginx/conf.d/discourse.conf for server\_name. At the moment I have:

```
server {
    listen 80;
    server_name psychematters.net www.psychematters.net;

```

Where [psychematters.net](http://psychematters.net) is one domain of many on my server, the one that I would like to use Discourse on.

When I start nginx it affects all of the domains on my server though, with a “Welcome to nginx” message showing on the home page of each site.

What do I need to do to get this working properly, such that I can use Discourse on just the psyche [matters.net](http://matters.net) site?

Do I need to make any changes to /etc/nginx/conf.d/default.conf, which currently has the following for server?:

```
server {
    listen 80;
    server_name localhost;

```

---

<div class="post-metadata">

### 作者： ![blau](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blau/32/34145_2.png) [@blau](https://meta.discourse.org/u/blau)
#### 发布日期： [2014 年10 月 30 日 08:34 UTC](https://meta.discourse.org/t/setting-up-nginx-for-use-with-discourse/21656/2 "2014-10-30T08:34:01Z")

</div>

You may be interested in this:

> [@Run other websites on the same machine as Discourse](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247):
>
> @pfaffman edited this heavily 2022.02.24. Blame me if it’s broken. If you want to run other websites on the same machine as Discourse, you need to set up an extra NGINX or HAProxy proxy in front of the Docker container. NOTE: This is for advanced admins This guide assumes you already have Discourse working - if you don’t, it may be hard to tell whether or not the configuration is working. You cannot use ./discourse-setup to set up Discourse if another server is using port 80 or 443. You will…
