| by Scott Kilroy

Welcome to Linux Consultant

This site is a collection of tips, examples and small chunks of code I’ve used over the years as I’ve worked with Linux. Mostly the items found here are for my own use but I’ve made the site public in the chance that it will help other people. If you find something useful please let me know. Also if you think something I’ve mentioned could be done better I would welcome the feedback.

Share Button
Read More
| by Scott Kilroy

Block php files from being uploaded (using nginx)

If you find people trying to upload php into your wordpress site you can add this to your nginx config file location ~* /(?:uploads)/.*.php$ { deny all; access_log off; log_not_found off; }

Share Button
Read More
| by Scott Kilroy

Intro to Git

If you’re new to Git checkout https://www.linuxtechi.com/learn-git-command-examples-linux-part-1/ it’s a good starting point.

Share Button
Read More
| by Scott Kilroy

Getting copy and paste to work in vncserver

Share Button
Read More
| by Scott Kilroy

Stop image hotlinking on NGINX

If you think it’s possible that someone is linking to images hosted on your site add the following to you nginx config file # Stop deep linking or hot linking location /images/ { valid_referers none blocked www.linuxconsultant.org linuxconsultant.org; if ($invalid_referer) { return 403; } } Or if you want to be a wiseguy and replace the hotlinked image with something else # Stop deep linking or hot linking location /images/ { valid_referers none blocked www.linuxconsultant.org linuxconsultant.org; if ($invalid_referer) { return […]

Share Button
Read More
| by Scott Kilroy

Misc git tips

Want to see if your branch is on the remote server? Want to see what branches are? Run git branch -av Not seeing your branch on the remote server, run git push origin BRANCH_NAME Added a file to .gitignore but you already checked it in? Run git rm –cached FILENAME Changing your origin server? Run git remote remove origin

Share Button
Read More
| by Scott Kilroy

When you totally screw up in git

When you totally screw up and want to do a git pull to replace all your files do this git reset –hard HEAD git pull

Share Button
Read More
| by Scott Kilroy

Working with a remote git repo

Create a directory (in this example we’ll use gitdir) cd into gitdir run git init this will create a empty git repo now run git remote add origin PATH_TO_REMOTE_GIT_SERVER ie git remote add origin file:///srv/git git clone ssh://user@server/project.git

Share Button
Read More