Editing apache .conf
Hey, I am trying to create a correct apache .conf so I can create a .htaccess file for WordPress. I am reading instructions from here: https://www.linode.com/docs/guides/how-to-set-up-htaccess-on-apache/
The first step is: sudo nano /etc/apache2/sites-available/example.com.conf
I already changed my hostname to my domain. Is the example.com.conf default or do I need to create one for mydomain.com.conf? Will that command create the file for me?
The next step is:
….
<directory example.com="" html="" public_html="" var="" www="">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</directory>
Do I have to change the example.com to mydomain.com?
1 Reply
Here's the documentation for the Directory directive:
https://httpd.apache.org/docs/2.4/mod/core.html#directory
In your example:
<directory example.com="" html="" public_html="" var="" www=""> Options Indexes FollowSymLinks AllowOverride All Require all granted </directory>
the ="" html="" public_html="" var="" www=""
is all nonsense. example.com
needs to be a directory in your filesystem (or a regex that matches one or more paths to directories in your file system).
Here's a working example from my web server:
Alias "/i" "/srv/ical/www"
<Directory /srv/ical/www>
AllowOverride None
Options -Indexes
Require all granted
...
</Directory>
So, the URL https://mydomain.com/i/foo.html (the /i/ part is the Alias) will serve the file /srv/ical/www/foo.html using https. What the .conf file in /etc/apache2/sites-available is called only matters to a2ensite/a2dissite. You could call yours xyzzy.conf if that made sense to you.
-- sw