Difference between revisions of "GPG guide/Setting Up Your Local Development Environment"

From LibrePlanet
Jump to: navigation, search
(Create virtual host)
(Enable server-side include module)
Line 12: 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

Revision as of 10:46, 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.

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 add the following to the bottom:

127.0.0.1 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.