Two Drupal installation on the same server - drupal

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/"

Related

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.

Expires headers on an Amazon EC2 with Bitnami 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.

Wordpress Noob: Forbidden You don't have permission to access / on this server. (using Mac)

So I followed this tutorial to set up my wordpress project on my local: http://jason.pureconcepts.net/2012/10/install-apache-php-mysql-mac-os-x/
However, it is giving me a
Forbidden You don't have permission to access / on this server.
error. I even tried changing the permissions of my project to 777, but nothing works. I should have Apache, MySQL, and PHP all running now. This is my /etc/apache2/extra/httpd-vhosts.conf file:
<VirtualHost *:80>
DocumentRoot "/Users/emai/Documents/wordpress_projects/ahrf"
ServerName ahrf.local
ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common
<Directory "/Users/emai/Documents/wordpress_projects/ahrf">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
And my /etc/hosts has this line 127.0.0.1 ahrf.local added. So it looks like my apache config + hosts file are configured properly. I even tried adding the default _www apache user to the staff group on my mac.
Does anyone know how to fix this?
While Macs are immensely easy and dumbed down compared to Linux and Unix Apple has added a ton more overhead in terms of trying to configure one as a server like you would normally configure a Unix or Linux system. They're running their own custom systems like Rendezvous, so there's a little more to configure and troubleshoot. That being said, here are a few things:
You should be able to connect to the system with the IP address and see the website. If you're not running a DNS server then the system will not publish the ahrf.local name. You would need to edit the hosts file of any systems trying to connect using that name. So on computer 2 you would edit the hosts file to see ahrf.local as 192.168.x.x (with the proper ip address for the web server of course).
If you install BIND you will need to make all of the other local machines check the DNS server first to see if the system exists.
Change permissions recursively in the folder to 755. You should never allow 777 because this allows "everybody" write access on the box. Wordpress has a ton of holes which can be found online by searching "Wordpress Hacked."
On Macs there's an issue with using the .local domain. .local is reserved for Rendezvous. While it will share files with this naming convention it's not really a published "domain name" and it will conflict with rendezvous if you're trying to use it in DNS.
Make sure (if you have firewall enabled under security) in the firewall you're allowing connections over port 80.
There is a web sharing option under newer versions of Mac OS. In my experience a lot of the systems that are in place in the GUI actually overwrite some of the command line additions. You'll need to either use the GUI exclusively or use the command line exclusively and then try to hunt down any issues in the GUI preventing the system from loading the page.
You don't need to run Apache as any other names or in any other groups other than the default as it only requires read and execute access to show the contents. The folders and files should have the permissions set for the user you're using to create the files. You don't want to make Apache own the files or you'll run into problems updating the system. Any folders where a user might upload a file like an image will need other permissions, but the main folder does not. Wordpress configures these settings on install.
If you want to run your Mac as a "production server" Apple has a "server" you can get "server" app from the app store that's basically another GUI interface for all of the stuff that normally comes available to Unix and Linux as installation options. It's cheap. This will allow you to run your own DNS server (and it's a little easier interface than editing BIND).
Also try pulling the directory declaration out of the VirtualHost. In all of the documentation examples they are separate.
<Directory "/Users/emai/Documents/wordpress_projects/ahrf">
Options -FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot "/Users/emai/Documents/wordpress_projects/ahrf"
ServerName ahrf.home
ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common
</VirtualHost>
Also remember after making changes to the .conf files you need to restart Apache. With .htaccess you do not have to restart after each change.
I know this is kind of old. But I followed same tutorial with my Mac machine to enable development with apache2 and faced the same situation.
To solve it I have added following line into my virtual host's directory. After that when I accessed a directory, apache didn't gave me a forbidden error.
Options Indexes FollowSymLinks MultiViews
After adding above line my virtual host configuration look like this.
<Directory "/Users/uiroshan/development/php">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Also please see the relevant section in apache documentation.
http://httpd.apache.org/docs/current/mod/core.html#options
Indexes
If a URL which maps to a directory is requested, and there is no DirectoryIndex (e.g., index.html) in that directory, then mod_autoindex will return a formatted listing of the directory.
Also enable the "Fancy directory listings" configuration file from your httpd.conf file.
Include /private/etc/apache2/extra/httpd-autoindex.conf
Hope this helps.
Easiest Solution I found was to symlink.
By default DocumentRoot is in /Library/WebServer/Documents
cd /Library/WebServer/
sudo mv Documents Documents-old
sudo ln -s <sourcedir> ./Documents
Dont mess up with OSX Apache config and break your head. Not worth it!

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 /

How to place certain files in the root directory of the Grails server?

I am using a grails application as backend for a Flex frontend. To be able to easily develop and debug my applications I would need to place a crossdomain.xml file into the root of the server, i.e. it must be accessible via http://localhost:8080/crossdomain.xml. Similar use cases might be the deployment of a favicon.ico or a robots.txt, however this can be done in the production environment through a tomcat server with a default root web application.
In my case however I need to have the crossdomain.xml available after running grails run-app. I know that I can move the entire application to the root (http://ca.rroll.net/2009/03/27/configuring-the-grails-root-application-context/) however this is also not what I want, since the grails application should still reside below its default application context.
Does somebody know, how I can do this? Will I have to reconfigure the jetty servlet container of my grails installation somehow?
I think I found the answer. I haven't tried this yet, so YMMV.
In this article, Colin Harrington discusses making a crossdomain.xml file available at the root of the server by deploying an additional Jetty context.
His technique was first proposed in this blog entry, where the author also discusses using the Static Resources Plugin as another alternative
I figured out a way to solve this with Apache and mod_proxy. This allows both your Grails install and Grails project to remain pristine. No hacking at the Grails internals, no adding plug-ins you may not need in production.
1. Install Apache httpd 2.2
Do this however makes the most sense for your operating system. It is important that you install Apache 2.2. I did this on an Ubuntu system, so any specific commands and file locations will be for Ubuntu. Modify as necessary for your system.
After you've installed Apache, start httpd.
sudo /sbin/service httpd start
Test that it is installed correctly using a web browser.
2. Create a root directory
Pick a location on your disk where you will keep your static files. This will be the document root for httpd. I will be using /var/grails_root.
mkdir /var/grails_root
touch /var/grails_root/crossdomain.xml
3. Create a VirtualHost in httpd.conf
Open httpd.conf in your favorite text editor.
vim /etc/httpd/conf/httpd.conf
Pick your favorite port, and create a virtual host on that port. I will be using 9090, but any port will do.
Add these lines to httpd.conf
Listen 9090
<VirtualHost *:9090>
DocumentRoot "/var/grails_root"
<Directory "/var/grails_root">
Allow from all
</Directory>
</VirtualHost>
Restart httpd
sudo /sbin/service httpd restart
Test that you are now able to access the static files in your document root directory. If not, you will need to fix this before moving on to the next step.
4. Enable mod_proxy and mod_proxy_http
You need to load both of these modules. mod_proxy has the base functionality for proxying, and the mod_proxy_xxx modules have information specific to a protocol. They ship standard with httpd 2.2, so you shouldn't need to install anything extra.
Add these lines to httpd.conf
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
Now modify the virtual host you set up in the previous step. (You can omit the comments)
<VirtualHost *:9090>
DocumentRoot "/var/grails_root"
<Directory "/var/grails_root">
Allow from all
</Directory>
# New lines start here
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /grailsApp http://your.grails.server:8080/grailsApp
# New lines end here
</VirtualHost>
Restart httpd
sudo /sbin/service httpd restart
Now, you should be able to access both your static files and your Grails app via port 9090.
This is all based on information found here: http://docs.codehaus.org/display/JETTY/Configuring+mod_proxy
Information for doing this with other versions of Apache is available on the same site.

Resources