change default folder for apache - wordpress

I have installed a Wordpress instance using Bitnami.
Currently 127.0.0.1 takes my to the file in the C:\Bitnami\wordpress-4.4.2-1\apache2\htdocs
I want 127.0.0.1 to take the user to C:/Bitnami/wordpress-4.4.2-1/apps/wordpress/htdocs
Changes i have done:
Edit the httpd.conf file
DocumentRoot "C:/Bitnami/wordpress-4.4.2-1/apps/wordpress/htdocs"
<Directory "C:/Bitnami/wordpress-4.4.2-1/apps/wordpress/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Require all granted
allow from all
</Directory>
Restarted apache server
Still going to 127.0.0.1 shows the index.php page under C:\Bitnami\wordpress-4.4.2-1\apache2\htdocs
What am i missing?

I don't know about Windows, but on my Ubuntu system, I also had to change document root in the sites-enabled/000-default.conf file. Just make sure all configuration files are updated correctly to point to your new document root.
Hope this helps!

Related

non www to www not working for wordpress in EC2 instance using safari

If I use my safari browser, I cannot get to my website example.com. I have to use www.example.com for it to work. I tried editing htaccess numerous times and still, it doesn't work.My website is using bitami wordpress image (https://docs.bitnami.com/)which is hosted in AWS.
Bitnami Engineer here:
By default, we disable .htaccess files due to security and performance reasons. We also move .htaccess files content to a file called htaccess.conf in the folder /opt/bitnami/apps/wordpress/conf. You can check more about it at https://docs.bitnami.com/aws/infrastructure/lamp/administration/use-htaccess/.
If you want to enable .htaccess usage, you would need to set it to AllowOverride All in /opt/bitnami/apache2/conf/bitnami/bitnami.conf file:
<VirtualHost _default_:80>
DocumentRoot "/opt/bitnami/apache2/htdocs"
<Directory "/opt/bitnami/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All <---- HERE
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3 >
Require all granted
</IfVersion>
</Directory>
And restart Apache after applying your changes.
For more info, find WordPress documentation below:
https://docs.bitnami.com/aws/apps/wordpress/
Regards

How to set Symfony3 environment in Apache

I am running Apache 2.4 on my development machine so I can test code locally. How do I tell Symfony 3.4 to use the 'dev' environment instead of the 'prod' environment?
I've tried browsing to http://localhost/app_dev.php but that just redirects to http://localhost/. It looks like the front controller is set in .htaccess but if I modify that file, then my production server will be using the wrong front controller.
I've read the docs on the following pages and it talks about how to create new environments but not how to set the default environment.
https://symfony.com/doc/3.4/configuration/environments.html
https://symfony.com/doc/3.4/setup/web_server_configuration.html
I'm running Apache 2.4 on Windows 10 and here is my vhost configuration
<VirtualHost *:80>
ServerName example.local
DocumentRoot "C:\Users\kento\PhpstormProjects\example\web"
<Directory "C:\Users\kento\PhpstormProjects\example\web">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
DirectoryIndex app_dev.php
</Directory>
ErrorLog "logs/example-error.log"
CustomLog "logs/example-access.log" common
</VirtualHost>
example.local points to 127.0.0.1 in my hosts file. I set DirectoryIndex to app_dev.php but that seems to be overridden by the .htaccess file.
You've already set the vhost to use app_dev.php, but then you allow a .htaccess to override with the AllowOverride All. Change that to AllowOverride None and the .htaccess will be ignored.
There may be some config from there you would be able to merge into the vhost.
I tend to prefer all the configuration in the virtual host, and not have any use of a .htaccess file, for a small speed boost - especially in production.

How to open my website with secure http (https)?

The company I'm working for has a PC for hosting our website. I can access the website with http without any problem but when I add https it gives me this error. We are using apache for our web server (XAMPP).
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
However when I try to copy the website to my other computer (also with XAMPP on it) and run the website in localhost with https its working fine. I tried to look for answer but I can't seem to find the one that I'm looking for. Does anyone have encountered this problem or know what may have caused this?
Thanks in advance
Had same issue on LAMP server. In the ssl.conf file we changed AllowOverride None for ; to AllowOverride All. That corrected the problem.
DocumentRoot /var/www/
< Directory />
Options FollowSymLinks
AllowOverride None
< /Directory>
< Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
< /Directory>
I fixed the problem. It was because the DocumentRoot directory and Servername in http-ssl.conf in apache/conf/extra folder was still set on default. I changed it so it uses the same servername and documentroot directory that I had specified in httpd-vhosts.conf

how to move Symfony project to an other folder?

I have started a project on Symfony2 and now I would like to change the place where I installed it in my files.
here where it is now:
Application/MAMP/htdocs/symfony/
What is I move the symfony file to
user/myWebSiteProject/...
by the way my composer is in:
user/myWebsitePorject/bin/composer/composer.phar
---------------------------------------------/path/composer.json
Can I do it just like it... move it just like any folder. or should I take into account some things...?
You can move the whole folder without any major issues. What you will need to do is to change any VirtualHosts you may have setup, You will need to update the DocumentRoot property.
You would normally find the file to update on a mac at: /etc/apache2/extra/httpd-vhosts.conf depending on how your system is configured.
I'm presuming that your using Apache, Your VirtualHost should look something like this:
<VirtualHost *:80>
ServerName local.symfony
DocumentRoot "/user/myWebSiteProject/web"
<Directory "/user/myWebSiteProject/web">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog "/private/var/log/apache2/local.symfony-error_log"
CustomLog "/private/var/log/apache2/local.symfony-access_log" common
</VirtualHost>
This guide should help with the configuration.

Hosting multiple domains in Apache2 - how?

Although I’ve found related articles on stackoverflow, I have seen various suggestions which I’ve tried out but I still experience problems, so that’s the reason why I’m posting this.
I have a question which involves DNS, Debian, Apache2 and Wordpress. I’ve been struggling with this for some time now and haven’t been able to solve it. My current conclusion is that 2there is something with my dns and apache virtual host definitions”, but, as I said I’m far from sure.
This is what my config looks like:
two domains which I “own” hosted by moniker.com - let’s call them domaina and domainb
a hosted vps with Debian, apache2 and wordpress. The vps has ip x.y.z.t
each domain has three ‘A’ records defined: ‘*’, ‘#’ and ‘www’
URL rewrite enabled (a2enmod rewrite)
Wordpress installed and links created to the wordpress directory for both document directories specified in the virtualhost directives below
Both ‘domaina’ and ‘domainb’ point to my vps and this is working ok. However, what I’ve been unable to solve is to have the vps handle “multiple virtual hosts”. I thought I would be able to handle this by using virtual hosts in Apache. For that purpose I’ve defined two sites under /etc/apache2/sites-available which looks like this:
(file: /etc/apache2/sites-available/domaina.com)
<VirtualHost x.y.z.t:80>
ServerName domaina.com
ServerAdmin me#domaina.com
DocumentRoot /var/www/domaina.com
DirectoryIndex index.php
<Directory /var/www/domaina.com/>
AllowOverride all
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
(file: /etc/apache2/sites-available/domainb.com)
<VirtualHost x.y.z.t:80>
ServerName domainb.com
ServerAdmin me#domainab.com
DocumentRoot /var/www/domainb.com
DirectoryIndex index.php
<Directory /var/www/domainb.com/>
AllowOverride all
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
Now, when I try to address the sites above from a web-browser I end up at the default apache directory with the index.html file rendered in the browser instead of arriving at the two different wordpress configurations. Obviously there’s something wrong with my thinking around “VirtualHosts” and/or DNS-configurations…
I forgot to mention that I've made loads of /etc/unit.d/apache2 restarts... Sorry...
Frankly speaking I’m lost here and any help on this would be very much appreciated.
Cheers
If you did restart apache and its still not working please respond, as I have experienced similar issues with Apache, especially when getting the virtual host to work. I realise your running on Debian which is different to WAMP, but this is what I do when opening a new virtual host.
First I add the domain to the windows system 32 drivers etc hosts file, it allows for intranet
127.0.0.1 domainname and this stops the url from looking to the web.
Then I have to add the corret directories to the www/your folder.
Just inside the root folder there ought to be a directory called vhosts,
I had to make totaly empty instances of the conf files with just the filename of the virtual hosts inside it so that the changes you made to the httpd-vhosts.conf works.
So what you will need to do is find the wamp/bin/apache/Apache2.2.21/conf/extra/httpd-vhosts makes sure that you have the one from the conf/axtra and not conf/orginal.
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/**name of the folder**"
ServerName **as_inserted_in_hosts**
<directory "c:/wamp/www//**name of the folder**">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</directory>
</VirtualHost>
Save. Apache stop all services, I also have to restart the service running the intranet in windows to update the changes to the hosts file and then restart apache.
This is what I have to do so that when I open localhost from Apache it allows me to see the links appear under virtual hosts as well as the directories appearing under your projects.
Have a look at this tutorial... Explains how to set up virtual hosts
Do you have a NameVirtualHost directive in your apache2.conf anywhere? You'll need that to enable virtual hosting. It can go in apache2.conf or any file included by apache2.conf. On my server I've got it in ports.conf.
NameVirtualHost *:80
See http://httpd.apache.org/docs/2.2/vhosts/name-based.html#using

Resources