# 在Hostinger安装VPS，使用Ubuntu 24.04 LTS和CloudPanel的LEMP堆栈

**URL:** https://meta.discourse.org/t/instalacao-vps-na-hostinger-com-stack-lemp-ubuntu-24-04-lts-e-cloudpanel/364881
**Category:** Self-hosting
**Tags:** unsupported-install
**Created:** [2025年五月5日 18:36 UTC](https://meta.discourse.org/t/instalacao-vps-na-hostinger-com-stack-lemp-ubuntu-24-04-lts-e-cloudpanel/364881 "2025-05-05T18:36:33Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Anderson\_Cardoso\_Silva](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anderson_cardoso_silva/32/501837_2.png) [@Anderson\_Cardoso\_Silva](https://meta.discourse.org/u/Anderson_Cardoso_Silva)
#### Post date: [2025年五月5日 18:36 UTC](https://meta.discourse.org/t/instalacao-vps-na-hostinger-com-stack-lemp-ubuntu-24-04-lts-e-cloudpanel/364881/1 "2025-05-05T18:36:33Z")

</div>

我正在运行 3 个使用 PHP Generic 和 Varnish 的 Drupal 7 网站。LEMP 堆栈使用 NGINX。  
我想为我的一个网站安装 Discourse 作为论坛。  
我安装了 docker，discourse，配置了子域和 /etc/nginx/sites-enabled/forum.linguagemclipper.com.br.conf。  
我创建了证书。  
安装后，我收到：The provided host name is not valid for this server.  
我收到了几个关于使用相同端口的错误。  
我认为我需要修复我的 .conf 和我的 app.yml，我已经尝试了多次，并得到了 chatgpt 的帮助，我运行了 ./discourse-doctor。  
我不知道该怎么办了……  
我的 .conf：

```plaintext
server {
    listen 80;
    listen [::]:80;
    server_name forum.linguagemclipper.com.br;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    http3 off;
    server_name forum.linguagemclipper.com.br;

    ssl_certificate /etc/letsencrypt/live/forum.linguagemclipper.com.br/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/forum.linguagemclipper.com.br/privkey.pem;

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
    }
}

```

我的 app.yml：

```plaintext
templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  ## Uncomment the next line to enable the IPv6 listener
  #- "templates/web.ipv6.template.yml"
  - "templates/web.ratelimited.template.yml"
  ## Uncomment these two lines if you wish to add Lets Encrypt (https)
# - "templates/web.ssl.template.yml"
# - "templates/web.letsencrypt.ssl.template.yml"

## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see https://meta.discourse.org/t/17247 for details
expose:
- "8080:80" # http internal Discourse mapped to port 8080
# - "3000:80" # http
# - "4433:443" # https

params:
  db_default_text_search_config: "pg_catalog.english"

  ## Set db_shared_buffers to a max of 25% of the total memory.
  ## will be set automatically by bootstrap based on detected RAM, or you can override
  db_shared_buffers: "2048MB"

  ## can improve sorting performance, but adds memory usage per-connection
  db_work_mem: "40MB"

  ## Which Git revision should this container use? (default: tests-passed)
  #version: tests-passed

env:
  LC_ALL: en_US.UTF-8
  LANG: en_US.UTF-8
  LANGUAGE: en_US.UTF-8
  DISCOURSE_DEFAULT_LOCALE: pt_BR

  # HTTPS is forced, even without using internal SSL
  DISCOURSE_FORCE_HTTPS: true

  ## How many concurrent web requests are supported? Depends on memory and CPU cores.
  ## will be set automatically by bootstrap based on detected CPUs, or you can override
  UNICORN_WORKERS: 4

```

一些错误：

```plaintext
+ /usr/bin/docker run --shm-size=512m -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=4 -e UNICORN_SIDEKIQS=1 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=400000 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e LC_ALL=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e DISCOURSE_DEFAULT_LOCALE=pt_BR -e DISCOURSE_FORCE_HTTPS=true -e DISCOURSE_HOSTNAME=forum.linguagemclipper.com.br -e DISCOURSE_DEVELOPER_EMAILS=anderson@linguagemclipper.com.br -e DISCOURSE_SMTP_ADDRESS=smtppro.zoho.com -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=anderson@linguagemclipper.com.br -e 'DISCOURSE_SMTP_PASSWORD=Clavis75!' -e DISCOURSE_SMTP_ENABLE_START_TLS=true -e LETSENCRYPT_ACCOUNT_EMAIL=anderson@linguagemclipper.com.br -h srv801054-app -e DOCKER_HOST_IP=172.17.0.1 --name app -t -p 8080:80 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-address 02:cd:20:6d:ed:a7 local_discourse/app /sbin/boot
f221ba6dc911301795806390816be38e78c26b71d94773c814f057817b88a776
docker: Error response from daemon: driver failed programming external connectivity on endpoint app (a5dc4c7ba846ccf556189495ce62e040cea87a62cf47e44fef76b4364fcb9e4a): Error starting userland proxy: listen tcp4 0.0.0.0:8080: bind: address already in use.

```

```plaintext
root@srv801054:/var/discourse# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
18cc215795b4 local_discourse/app “/sbin/boot” 22 minutes ago Created app
7cc7772ec84d discourse/base:2.0.20250226-0128 “/bin/bash -c '/usr/…” 22 hours ago Exited (0) 22 hours ago frosty_mendeleev
fb3ce2afb5a7 discourse/base:2.0.20250226-0128 “/bin/bash -c '/usr/…” 22 hours ago Exited (0) 22 hours ago determined_greider

```

```plaintext
root@srv801054:/var/discourse# sudo ss -ltnp | grep :8080
LISTEN 0 511 0.0.0.0:8080 0.0.0.0:* users:(("nginx",pid=885962,fd=26),("nginx",pid=885961,fd=26),("nginx",pid=674485,fd=26))
LISTEN 0 511 [::]:8080 [::]:* users:(("nginx",pid=885962,fd=27),("nginx",pid=885961,fd=27),("nginx",pid=674485,fd=27))
root@srv801054:/var/discourse# sudo lsof -i :8080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
cache-mai 400747 vcache 26u IPv4 4374453 0t0 TCP localhost:45054->localhost:http-alt (ESTABLISHED)
nginx 674485 root 26u IPv4 3106797 0t0 TCP *:http-alt (LISTEN)
nginx 674485 root 27u IPv6 3106798 0t0 TCP *:http-alt (LISTEN)
nginx 885961 root 26u IPv4 3106797 0t0 TCP *:http-alt (LISTEN)
nginx 885961 root 27u IPv6 3106798 0t0 TCP *:http-alt (LISTEN)
nginx 885961 root 44u IPv4 4374454 0t0 TCP localhost:http-alt->localhost:45054 (ESTABLISHED)
nginx 885962 root 26u IPv4 3106797 0t0 TCP *:http-alt (LISTEN)
nginx 885962 root 27u IPv6 3106798 0t0 TCP *:http-alt (LISTEN)
root@srv801054:/var/discourse#

```

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2025年五月5日 20:41 UTC](https://meta.discourse.org/t/instalacao-vps-na-hostinger-com-stack-lemp-ubuntu-24-04-lts-e-cloudpanel/364881/3 "2025-05-05T20:41:00Z")

</div>

> [@Anderson\_Cardoso\_Silva](#):
>
> `listen tcp4 0.0.0.0:8080: bind: address already in use.`

看起来有其他东西在使用该端口。尝试换一个端口？在更改 `app.yml` 中的端口后，您可以执行

```
./launcher destroy app;./launcher start app

```

而不是进行完全重建。

---

<div class="post-metadata">

### Author: ![Anderson\_Cardoso\_Silva](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anderson_cardoso_silva/32/501837_2.png) [@Anderson\_Cardoso\_Silva](https://meta.discourse.org/u/Anderson_Cardoso_Silva)
#### Post date: [2025年五月11日 17:06 UTC](https://meta.discourse.org/t/instalacao-vps-na-hostinger-com-stack-lemp-ubuntu-24-04-lts-e-cloudpanel/364881/4 "2025-05-11T17:06:09Z")

</div>

DISCOURSE已安装但无法发送电子邮件

我已将app.yml中的Discourse端口更改为8888，并在Cloudpanel的vhost中也进行了更改，然后停止了NGINX以重新编译Discourse，并且成功了。  
我重新启用了NGINX，网站和Discourse都正常运行。  
问题是Discourse根本无法发送电子邮件，我们需要帐户激活电子邮件。  
我已经更改了端口，但没有效果。  
在同一台服务器上，我在Docker中安装了Mailcow，并且电子邮件的发送和接收都正常。

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [2025年五月21日 22:32 UTC](https://meta.discourse.org/t/instalacao-vps-na-hostinger-com-stack-lemp-ubuntu-24-04-lts-e-cloudpanel/364881/5 "2025-05-21T22:32:59Z")

</div>

看起来你在你的服务器上做一些很有创意的酷炫工作！请注意，我们只能在你使用官方安装说明的情况下提供支持。请查看并再次尝试遵循说明，其中也提供了故障排除步骤。

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2025年六月20日 22:33 UTC](https://meta.discourse.org/t/instalacao-vps-na-hostinger-com-stack-lemp-ubuntu-24-04-lts-e-cloudpanel/364881/6 "2025-06-20T22:33:24Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
