Difference between revisions of "GPG guide/Setting Up Your Local Development Environment"
(→Edit your hosts file: proper hosts file) |
|||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | You can view your local copies of the guide's HTML files, but they will not be styled at all. To see the guide the way it actually looks online (recommended), you need to set up an Apache server on your computer for development. | ||
+ | |||
+ | ==Instructions== | ||
+ | |||
Apache is required in order to replicate the appearance of the website | Apache is required in order to replicate the appearance of the website | ||
on the live and staging servers on your machine. If you don't want to | on the live and staging servers on your machine. If you don't want to | ||
Line 8: | Line 12: | ||
the commands below as the root user using `sudo`. | the commands below as the root user using `sudo`. | ||
− | ==Enable server-side include module== | + | ==Enable server-side include module and rewrite module== |
− | <nowiki>a2enmod include</nowiki> | + | <nowiki>a2enmod include |
+ | a2enmod rewrite | ||
+ | </nowiki> | ||
If this doesn't work, you may not have Apache installed. Install the | If this doesn't work, you may not have Apache installed. Install the | ||
Line 18: | Line 24: | ||
Create a new file called esd.conf in `/etc/apache2/sites-available` with the following contents: | Create a new file called esd.conf in `/etc/apache2/sites-available` with the following contents: | ||
+ | |||
+ | Replace all instances of `PATH-TO-ESD-REPO` with the full path to the root directory of your local git repository AND 'PATH-TO-LOG-DIRECTORY' with a a path to a directory where you want to keep your logs (up to you, but please not in the git repository). It's not generally a good idea to turn off the logging. | ||
<nowiki> | <nowiki> | ||
Line 53: | Line 61: | ||
==Edit your hosts file== | ==Edit your hosts file== | ||
− | Edit your system's `/etc/hosts` file and | + | Edit your system's `/etc/hosts` file and edit the line starting with 127.0.0.1 to include esd-local-dev.fsf.org at the end, for example: |
− | <nowiki>127.0.0.1 esd-local-dev.fsf.org</nowiki> | + | <nowiki>127.0.0.1 localhost esd-local-dev.fsf.org</nowiki> |
==Test== | ==Test== | ||
− | Visit | + | Visit http://esd-local-dev.fsf.org/en in your web browser. If everything is configured properly, you will see the English version of the site, and the language translation dropdown will work. If you see all the names of the languages written out in lines with no dropdown, then JavaScript is not working. If the text appears on a plain white background with minimal formatting, then CSS is not working. To access the CSS, you need to be online, because it's stored on the FSF's remote server. |
− | everything is configured properly, you will see the English version of the site, and the language translation dropdown will work. |
Latest revision as of 11:33, 19 July 2017
You can view your local copies of the guide's HTML files, but they will not be styled at all. To see the guide the way it actually looks online (recommended), you need to set up an Apache server on your computer for development.
Contents
Instructions
Apache is required in order to replicate the appearance of the website on the live and staging servers on your machine. If you don't want to install Apache, you can still work on the site, you just won't be able to see what it looks like until you push to the remote.
Modifying Apache's configuration files and running its executables typically requires root access. So, you will most likely need to run the commands below as the root user using `sudo`.
Enable server-side include module and rewrite module
a2enmod include a2enmod rewrite
If this doesn't work, you may not have Apache installed. Install the package apache2 from your package manager.
Create virtual host
Create a new file called esd.conf in `/etc/apache2/sites-available` with the following contents:
Replace all instances of `PATH-TO-ESD-REPO` with the full path to the root directory of your local git repository AND 'PATH-TO-LOG-DIRECTORY' with a a path to a directory where you want to keep your logs (up to you, but please not in the git repository). It's not generally a good idea to turn off the logging.
<VirtualHost *:80> RewriteEngine on ServerName esd-local-dev.fsf.org ServerAdmin webmaster@localhost DocumentRoot /PATH-TO-ESD-REPO <Directory /PATH-TO-ESD-REPO/> Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted Order deny,allow deny from none allow from all SSILegacyExprParser on Options +Includes XBitHack on </Directory> ErrorLog /PATH-TO-LOG-DIRECTORY/error.log CustomLog /PATH-TO-LOG-DIRECTORY/access.log combined </VirtualHost>
Replace all instances of `PATH-TO-ESD-REPO` with the full path to the root directory of your local git repository AND 'PATH-TO-LOG-DIRECTORY' with a a path to a directory where you want to keep your logs (up to you, but please not in the git repository). It's not generally a good idea to turn off the logging.
Enable virtual host
a2ensite esd
Restart Apache
service apache2 restart
Edit your hosts file
Edit your system's `/etc/hosts` file and edit the line starting with 127.0.0.1 to include esd-local-dev.fsf.org at the end, for example:
127.0.0.1 localhost esd-local-dev.fsf.org
Test
Visit http://esd-local-dev.fsf.org/en in your web browser. If everything is configured properly, you will see the English version of the site, and the language translation dropdown will work. If you see all the names of the languages written out in lines with no dropdown, then JavaScript is not working. If the text appears on a plain white background with minimal formatting, then CSS is not working. To access the CSS, you need to be online, because it's stored on the FSF's remote server.