Expires headers on an Amazon EC2 with Bitnami Wordpress - wordpress

I'm working with a client who has a Wordpress installation (via Bitnami) set up on an Amazon EC2. I didn't put this together, and for background I am a Front-end Developer who is used to cPanel and has limited knowledge for the command line.
I'm trying to modify the expires headers to improve the speed of the client's site. Following this tutorial (http://www.theitbaby.com/wordpress/2013/10/14/optimizing-bitnami-for-pagespeed-insights-and-gtmetrix/) I was looking for the htaccess.conf file in my opt/bitnami/apps/wordpress/conf/ folder, however none existed. Do I make my changes in the httpd-app.conf file?
Alternatively I saw a few other resources out there with a line to include the htaccess.conf file added to httpd-app.conf - something like
Include /opt/bitnami/apps/wordpress/conf/htaccess.conf
Do I add this to the httpd-app.conf file and then create htaccess.conf and work there? Sorry for the confusion, just looking for some direction as I try to do my typical performance boost work.

So the option what you are describing: creating and htaccess.conf file and then adding it as an Include statement in the httpd-app.conf file under /opt/bitnami/apps/wordpress/conf/ is correct.
Make sure your Include statement is within the Directory directive and in the htaccess.conf file you don't need to have the Directory directive:
<Directory "/opt/bitnami/apps/wordpress/htdocs">
...
Include /opt/bitnami/apps/wordpress/conf/htaccess.conf
...
</Directory>
You can also add the pagespeed configs directly to the http-app.conf file if you'd like to inside the Directory directive too.
There's another option, but not necessarily popular if you have access to the main apache configuration files. You can create a .htaccess file under /opt/bitnami/apps/wordpress/htdocs and put your pagespeed statements there. In this care you need the following statement preconfigured by the sysadmin in the http-app.conf file.
<Directory "/opt/bitnami/apps/wordpress/htdocs">
...
AllowOverride All
...
</Directory>
You can read more about .htaccess here: http://httpd.apache.org/docs/current/howto/htaccess.html
Hope this helps.

Related

Setting up an Apache VirtualHost for Symfony

Admittedly I am utterly new to Symfony and I am irritated.
I am using the docu here: [0]. After setting everything up with "symfony/apache-pack" I get the ".htaccess" file with heaps of stuff in the "/public" directory. Now I wanted to be smart and moved all the rewrite rules to a proper VirtualHost and deleted the "htaccess" file. BANG, the required script files are not being loaded from the vendor directory and not style appear on the website. After killing all rewrite rules from the VirtualHost we website is up and running again.
Because of this sentence "A performance improvement can be achieved by moving the rewrite rules from the .htaccess file into the VirtualHost block of your Apache configuration and then changing AllowOverride All to AllowOverride None in your VirtualHost block." I am confused now since it suggests that I imperatively need rewrite rules for Symfony.
Note that I changed to AllowOverride None.
Can anyone shed some light onto this. I somehow feel that I am doing something dead wrong.
[0] https://symfony.com/doc/current/setup/web_server_configuration.html#web-server-apache-mod-php

Wordpress on Nginx server - .htaccess vs. nginx.conf

I have recently changed from Apache to Nginx server and running a Wordpress installation that was migrated onto this new Nginx server.
I only just realised that (the server provider forgot to mention) that the .htaccess file is no longer supported and shouldn't be used with Nginx.
Instead the nginx.conf file should be used. I know I can convert the contents of my current .htaccess file to nginx.conf using one of the convertors, but I don't even have the nginx.conf file.
Can I just create one?? And If I create one, do I place it into the root where currently my .htaccess file is??
Do I then delete the existing .htaccess file?
How should I go about this?
You definitely have nginx.conf - without it, your site wouldn't work. It is in /etc/nginx/ folder, and some additional configs can exist there and in subfolders.
Standard recommendations for WordPress with nginx you can find here in Codex. But if your site works, you have nothing else to do.
Unlike Apache with .htaccess files, nginx does not use any configuration files in WordPress folders. Everything is centralized in /etc/nginx/.
.htaccess files are ignored by nginx and can be deleted or kept in WordPress folders - it doesn't matter.
However, if you have some non-standard tuning in .htaccess files, you should implement relevant directives in nginx conf files. Convertors not very good for it, and produce errors sometimes, unfortunately. You should learn Apache rules used and create similar for nginx by yourself.

Enable open directory (folder browsing) .htaccess and httpd.conf

I am running WordPress on an AWS instance. I would like to open up a single directory on my server to allow folder browsing.
I have tried adding an .htaccess file to folder with the line
Options +Indexes
I have also tried modifying the httpd.conf file in /opt/bitnami/apache2/conf and adding
<Directory "/publicFolder">
Options +Indexes
AllowOverride All
Require all granted
order allow,deny
Allow from all
</Directory>
I have tried various combinations of the above options, but nothing seems to work. I have made sure to reboot the AWS instance after updating httpd.conf.
When I try to access the folder, I get a default WordPress page with the message "OOPS! THAT PAGE CAN’T BE FOUND." It is probably a simple mistake, but this is all new to me.
Thanks!
Directory is used for absolute file system paths. Make sure you speficy the whole path instead of just the relative path from documentroot.
Extra Note: Don't mix 2.2 and 2.4 directives. Remove Order/Allow directives.

Two Drupal installation on the same server

I installed Drupal 7 in the root folder of my server.
Now I would like to install another Drupal 7 website in a subfolder (/test), but when I run the /test/install.php script, I get:
"
To start over, you must empty your existing database.
To install to a different database, edit the appropriate settings.php file in the sites folder.
...
"
It seems that it is still loking at the database of the version in the root folder.
In /test/sites/default/config.php I set the new db.
I suspect that this is all related to .htacess and rewrite rules.
Somebody can help?
thank you in advance!
I realize this post is old, however there is, in my opinion, a more thorough and lower risk option than creating a re-write rule to resolve this problem.
The alternate option for this situation is to use a virtual host entry in your .htaccess file.
In order to do this properly you must create two virtual host entries. One entry for the original URL/Drupal 7 install (the one # the site root).
The second virtual host entry will be for a second URL which points to the Drupal 7 site in the subdirectory.
To do this correctly you must first enter the following line (or un-comment the line if it already exists):
NameVirtualHost *:80
Next you must create the two virtual host entries.
One will be similar to the following:
<VirtualHost *:80>
ServerName your.url.fortheroot
ServerAlias alternate.url.fortheroot
DocumentRoot "/path/to/webroot"
</VirtualHost>
The next entry would be similar to the following
<VirtualHost *:80>
ServerName your.url.forthesubfoldertest
ServerAlias alternate.url.forthesubfolder
DocumentRoot "/path/to/webroot/test"
</VirtualHost>
If you do not use the virtual host method and you choose the rewrite method there is a possibility that you may need to modify the settings.php to reflect the correct base root of your Drupal 7 install for the one in the /test subdirectory.
(try without but if you have problems with clicking on links giving you 404 errors then try with).
NOTE: I still definitely recommend the virtual host path over the rewrite rule path.
I performed a similar operation by having a sub folder installation of Drupal I used for staging purposes.
I added the following to my .htaccess of the original drupal installation to tell it to ignore my subfolder. Otherwise the original installation will try to handle access to the subfolder installation.
#Place this right below RewriteEngine on
RewriteCond %{REQUEST_URI} "/test/"

WAMP + directory alias + Drupal clean URLs

I have WAMP installed on my pc where I would like to run Drupal 6.
When I'm installing Drupal, I get the option to activate Clean URLs.
First I put my Drupal install in the www folder and I could choose to enable the clean URLs, but for backup reasons I moved it outside the www folder and created an alias the would point to the folder.
When I installed Drupal again, I couldn't choose to enable clean URLs anymore; the option was grayed out.
I would like to know why this happens; it seems some Apache module or PHP extension isn't available outside the www folder.
Just to be sure, I also tried an XAMPP install and created an alias with the some code lines as in the WAMP server but that worked, for some reason. The Apache version in WAMP isn't the same as the XAMPP install but I don't really think that is relevant.
I believe it's an config error in WAMP but I can't find out what.
Clean URLs doesn't work in the directory you copied Drupal because for that directory the directive AllowOverride is not set to All.
Drupal requires that every directives found in .htaccess files are enabled, in order to enable clean URLs; the directive AllowOverride, when set to All, allows to use all the directives that a .htaccess can contain.
The reason that in one case you can select the the option to enable the clean URLs, and in the other case is not selectable, is that Drupal, during its installation verifies the server is set to work with clean URLs, and change the form field to read-only if the server cannot support such feature.
To notice that the .htaccess file provided from Drupal can possibly need to be edited, in order to enable the clean URLs, as reported in the following comments, found inside the .htaccess file.
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /

Resources