我在 digitalOcean 上有一个 droplet,我通过 docker 在那里设置了我的应用程序。我还将它连接到一个域,当我访问 wwww.myDomain.com:3000 时它就会运行。
我想摆脱“3000”部分,在研究过程中我发现了我正在尝试配置的 nginx。我一直面临的问题是我找到了很多文章,但没有一篇给我一个直接的答案。
我在 digitalOcean 上连接到我的 ubuntu,我现在就在这里:
#
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/myDomain.com;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _; myDomain.com
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
哪个是模板。我已将 serverName 和 root 更改为“myDomain.com”,但就其余部分而言,我现在有点过头了,老实说,我不知道还有什么要改变才能让它工作。
下一步是设置 SSL,但我需要一些帮助才能做到这一点,并且可能需要一两个链接到一些好的教程/文章。