Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to serve PHP files from a subdirectory of xgboost-ci.net #10

Open
hcho3 opened this issue Jul 14, 2020 · 1 comment
Open

How to serve PHP files from a subdirectory of xgboost-ci.net #10

hcho3 opened this issue Jul 14, 2020 · 1 comment

Comments

@hcho3
Copy link
Owner

hcho3 commented Jul 14, 2020

I've set up a website from a subdirectory of xgboost-ci.net: https://xgboost-ci.net/dashboard/. In #6, we chose Nginx for the web server, so we modify the Nginx configuration here.

  1. Create the directory /var/www/xgboost-ci.net/html/dashboard.
  2. Create the file index.php in /var/www/xgboost-ci.net/html/dashboard with the following content:
<?php phpinfo(); ?>
  1. Since Nginx doesn't contain native PHP processing like Apache, we install the FastCGI PHP bridge by running sudo apt install php7.2-fpm php7.2-mbstring php7.2-xml php-pear.
  2. Open the configuration file /etc/nginx/sites-enabled/xgboost-ci.net. Add the following configuration block to the server block:
location ^~ /dashboard {
    alias /var/www/xgboost-ci.net/html/dashboard;
    try_files $uri $uri/ =404;
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    }
}

Also, change the line index index.html index.htm; to index index.html index.htm index.php;.
5. Run sudo nginx -t to verify the modified configuration.
6. Restart Nginx to apply the new configuration: sudo systemctl reload nginx.
7. Verify that https://xgboost-ci.net loads the Jenkins website and that https://xgboost-ci.net/dashboard/ loads the index.php we created earlier.

@hcho3

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant