Skip to content

Instantly share code, notes, and snippets.

@miranda-zhang
Last active April 2, 2019 18:18
Show Gist options
  • Save miranda-zhang/937b613cd61c850ffd9f578fa72ac648 to your computer and use it in GitHub Desktop.
Save miranda-zhang/937b613cd61c850ffd9f578fa72ac648 to your computer and use it in GitHub Desktop.

Apache Web Server

Ubuntu

apt-get install apache2

Suppress warning message Could not reliably determine the server's fully qualified domain name

Add at the bottom of /etc/apache2/apache2.conf

ServerName server_domain_or_IP

e.g. echo "ServerName 127.0.0.1" >> /etc/apache2/apache2.conf

Check for syntax errors:

apache2ctl configtest

Restart Apache to implement your changes:

service apache2 restart
apache2ctl restart

Make sure that UFW has an application profile for Apache like so:

# ufw app list
Available applications:
  Apache
  Apache Full
  Apache Secure

If you look at the Apache Full profile, it should show that it enables traffic to ports 80 and 443:

# ufw app info "Apache Full"
Profile: Apache Full
Title: Web Server (HTTP,HTTPS)
Description: Apache v2 is the next generation of the omnipresent Apache web
server.

Ports:
  80,443/tcp

Allow incoming traffic for this profile:

ufw allow in "Apache Full"

Check by visiting: http://localhost/

https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04

Stop Nginx interference (if exist) service nginx stop

CORS

https://addons.mozilla.org/en-US/firefox/addon/cors-everywhere/

htaccess

In /etc/apache2/apache2.conf

Change

AllowOverride All

i.e.

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

Run command

a2enmod rewrite

Coppying files to:

/var/www/html/

Gracefully reload its configuration

service apache2 reload

Testing content negotiation with curl, e.g.:

curl -H "Accept: application/rdf+xml" -L http://150.203.213.249/v0.1
curl -LH "Accept: application/ld+json" http://150.203.213.249/v1.0
curl -LH "Accept: application/n-triples" http://localhost/v1.0
curl -H "Accept: text/turtle" -L http://150.203.213.249/v1.0

Chrome redirect cache

https://salferrarello.com/chrome-clear-redirect-cache/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment