Author: Biri

Ubuntu Apache & PHP read/write access

Give Ubuntu’s Apache2 ownership to the directory (-R is all files within it)

sudo chown -R www-data /var/www/html/some_directory

Give that folder read/write access:

sudo chmod 755 /var/www/html/some_directory

WordPress Ubuntu Apache: interpret URL as a lower URL

This guide is to help users who were previously on a case insensitive web server and hosting many directories and files on their server mixed with upper and lower case letters who wish to move to a server that has case sensitivity such as Linux, or more specifically Ubuntu running Apache.

In this scenario, the Ubuntu Apache server is also running a Multi-site WordPress, running multiple domains on the same server so the traditional ways of configuring the vhosts file may not possible.

The trick is to set up a rewrite rule that essentially takes any URL provided to the server, and interprets it as a lowercase URL.

This seems pointless at first, but the trick is that the files being migrated to the Multi-site WordPress server, can be copied in just lower case form.

I found the easiest trick is to simply zip up all of the files, and then unzip them.

zip -0 -r foo.zip foo/
unzip -LL foo.zip

This will zip up the foo directory (including the directory itself) that contains all of the files and folders, and then UNZIP it all using the -LL flag which makes it all lowercased folders and files.

You can then perform the command:

cp -r /foo/* /var/www/html

to move the contents of everything that was inside the foo folder, directly into the html folder.

This will take care of having a migrated set of data that’s strictly in lower cased form.

The next step is to have Apache actually reference the lower case version each time a request is made.

For that we’ll need to sure mod_rewrite is enabled if it’s not already by running:

sudo a2enmod rewrite
sudo service apache2 restart

Next, we’ll need to edit the global apache2 conf file

sudo nano /etc/apache2/apache2.conf

At the bottom of the file include the lines:

RewriteEngine On
RewriteMap  lc int:tolower

Next, we’ll need to edit the .htaccess file used by WordPress

This should be found in the root of our webserver directory that WordPress is hosted on.

sudo nano /var/www/html/.htaccess

At the top of the file under the Options -Index (if it exists as the first line)

Place the lines of:

RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]

The RewriteCond will check if any characters in the URL contain a capital letter.

If there is a capital letter found, it will run the function lc (defined in the apache2.conf file) that will convert the string $1, which is the regex group defined by (.*)  which is the whole URL in this case, to a lower case string.

It will then perform a redirect 301, and the L will indicate that this the LAST thing involved with this RewriteCond and RewriteRule set.

Disabling Browsable Directories with Apache

The simplest way is to modify the root directory .htaccess file and at the top of the file add the line of:

Options -Indexes

It took me longer than I wish it had to find this so hopefully this helps out others in the future.

How To Create a SSL Certificate on Apache for Ubuntu 12.04

This guide is intended to serve as documentation and is practically a copy and paste of the guide found on DigiCert website.
Source: https://www.digicert.com/ssl-certificate-installation-ubuntu-server-with-apache2.htm

With that said this guide is a great one for generating a self signed certificate on an Ubuntu server running Apache.

Let’s Begin!

What the Red Means

The lines that the user needs to enter or customize will be in red in this tutorial! The rest should mostly be copy-and-pastable.

About SSL Certificates

A SSL certificate is a way to encrypt a site’s information and create a more secure connection. Additionally, the certificate can show the virtual private server’s identification information to site visitors. Certificate Authorities can issue SSL certificates that verify the server’s details while a self-signed certificate has no 3rd party corroboration.

Continue reading

Install Skype for Arch Linux (as of April 2017)

I discovered through trial-and-error and then finally from a response on a forum that the pacman -S skype won’t work for installing Skype these days since it’s too old and outdated. (Or something along those lines)

Instead, download the snapshot file from here: https://aur.archlinux.org/packages/skypeforlinux/

Extract the files to a folder.

CD into the directory and then: (NOT using sudo) Run:

$makepkg -si

This will make everything, install dependencies, make the package, install the package.

Source: https://wiki.archlinux.org/index.php/Arch_User_Repository

Installing packages

Installing packages from the AUR is a relatively simple process.

Essentially:
  1. Acquire the build files, including the PKGBUILD and possibly other required files, like systemd units and patches (often not the actual code).
  2. Verify that the PKGBUILD and accompanying files are not malicious or untrustworthy.
  3. Run makepkg -si in the directory where the files are saved. This will download the code, resolve the dependencies with pacman, compile it, package it, and install the package.

MySQL Accessible Beyond localhost

This is something that had eluded me in the past so I wanted to write a very quickly documentation on the subject.
(In the past, I always thought the issue was purely firewall related.)

For MySQL running on an Ubuntu 14 server, the change is extremely simple to allow for incoming DB connections.

Continue reading

Increase Upload File Size for Apache Ubuntu 14

This documentation/guide is for how to modify Ubuntu 14’s Apache PHP5 so that a larger file size can be uploaded.
In this example, I modified the file size limit of 2mb to 4mb, as well as increased the max_execution_time so that there’s enough time to actually upload the larger file size to the server.

The process can be achieved several ways.

The easiest method is to modify php.ini.

sudo nano /etc/php5/apache2/php.ini

Modify the following lines:

upload_max_filesize = 4M
post_max_size = 8M #default
max_execution_time = 300

After saving the file, restart apache:

sudo service apache2 restart

い and な adjective conjugation

い Adjectives

い Adjectives have their い character replaced with something else.

  1. FIRST Apply a negative conjugation if the adjective is to be negated.
  2. THEN Apply past conjugation if it was a past descriptive adjective.

Negative Uses: くな Which actually brings in a new to use for the replacement character.

Past Conjugation: replaces with かった

Adjective Conjugation Example:
Dictionary Form: ねむ

  • Present Affirmative: ねむです。
  • Present Negative: ねむくなです。
  • Past Affirmative: ねむかったです。
  • Past Negative: ねむくなかったです。

な Adjectives

な Adjectives work similarly to い adjective conjugation IFF it’s in negative form, except we “introduce” a helper to give us that that we need to conjugate with as if it were an adjective in this case.

The result is that for something like げんき we add じゃない to make it negative. Then we modify the い in じゃない to make it じゃなかった. Similar to how it’s performed with い adjectives.

If it’s not a negative な adjective, the です is modified from ですー>でした。

Similar to how a verb is conjugated to past tense.

な Adjective Conjugation Example:

Dictionary Form: げんき

  • Present Affirmative: げんきです。
  • Present Negative: げんきじゃなです。
  • Past Affirmative: げんきでした
  • Past Negative: げんきじゃなかったです

Irregular Adjectives

Irregular Adjectives have their own very special rules, unique to the adjective.

The most notable is the いい irregular adjective.
A few other adjectives that share the ending of いい have this conjugation as well (such as かっこいい if I’m not mistaken…)

Irregular Adjective Conjugation Example:

Dictionary Form: いい

  • Present Affirmative: いいです。
  • Present Negative: よくなです。
  • Past Affirmative: よかったです。
  • Past Negative: よくなかったです。