Self-Hosting Git Repos and Installing GitList for a Web Interface

Hosting your git repositories yourself is as simple as git init --bare (or git clone --bare for existing repos) in a directory on your server, and then adding the remote to your local repo: git remote add myServer ssh://me@server.address/path/to/repo/project.git.

Having your repos on GitHub too makes for a nice redundancy (or on any other git server), and a remote on your server, on GitHub and a local copy makes for three redundancies. You can push to multiple remotes by adding a few lines in your project’s git config.

Continue reading

Enabling in-line PHP parsing with Nginx

My Environment

  • Nginx version
    • 1.10.0
  • PHP version
    • 7.0
  • FastCGI processor
    • php7.0-fpm
  • Kernel
    • Ubuntu 16.04

The First And More Obvious Step

To enable parsing of PHP in HTML files, editing a server block’s location block to include files with an HTML extension should be sufficient.
For example:

# /etc/nginx/sites-available/mywebsite.com
location ~ \.(php|html)$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}

However, since I am working with PHP 7, whose full name is “php7.0” (which is usefully descriptive but makes things tricky when initially looking for related directories or daemons), I had an extra step in order to make this work. And apparently, all PHP versions, from late php5.* to php7.0, will require this extra step.

Continue reading