配置nginx
如果你不想在域名输入端口号,有两个方法,一是用80端口运行,二是做反向代理,这里以nginx做反向代理为例。
server { listen 80; server_name www.example.com; root /wwwroot/publish/cherish-time-php/public; access_log /wwwroot/publish/cherish-time-go/logs/access.log; error_log /wwwroot/publish/cherish-time-go/logs/error.log; index index.php index.html index.htm; # ssl ------ listen 443 ssl; ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; location /api/ { try_files /_not_exists_ @backend; } location @backend { proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:8080; } }