kutr icon indicating copy to clipboard operation
kutr copied to clipboard

Run Kutr on Web with a domain

Open popouille opened this issue 7 years ago • 1 comments

How to run it with domain.

Can we run it with a domain as the server needs to be started with 127.0.0.1 and a port by php artisan serve

i can acess the login page with my http://www.domain.com, but i can't login. But if i artisan serve on my IP server with php artisan serve --host=... then i access http://...:port i can login.

Thank you

popouille avatar May 03 '18 11:05 popouille

I'm not using php's internal HTTP server but nginx as a reverse proxy for php-fpm. This is much more efficient, and easier to maintain. Using a domain is straightforward with nginx, here's my configuration for the subdomain:

server {
    listen       80;
    server_name  music.domain.com;

    root  /srv/www/path/to/public_html/kutr;
    access_log /srv/www/path/to/logs/kutr.access.log;
    error_log /srv/www/path/to/logs/kutr.error.log;
    index index.php;

  # Whitelist only index.php, robots.txt, and those start with public/ or api/
  if ($request_uri !~ ^/$|index\.php|loginRedir\.php|robots\.txt|api/|public/) {
    return 404;
  }

  location /media/ {
    internal;

    # A 'X-Media-Root' should be set to media_path settings from upstream
    alias       $upstream_http_x_media_root;
  }

  location / {
    try_files   $uri $uri/ /index.php?$args;
  }

  location ~ \.php$ {
    try_files $uri $uri/ /index.php?$args;

    fastcgi_param     PATH_INFO $fastcgi_path_info;
    fastcgi_param     PATH_TRANSLATED $document_root$fastcgi_path_info;
    fastcgi_param     SCRIPT_FILENAME $document_root$fastcgi_script_name;

    fastcgi_pass unix:/run/php/php7.0-fpm.sock; #/tmp/php.sock;
    fastcgi_index             index.php;
    fastcgi_split_path_info   ^(.+\.php)(/.+)$;
    fastcgi_intercept_errors  on;
    include                   fastcgi_params;
  }
}

X-Ryl669 avatar May 06 '18 19:05 X-Ryl669