My website is showing apache test page - wordpress

I created website on Amazon Web Server. I route my ip to my domain using ROUTE 53 service. but now my website is showing APACHE TEST PAGE rather then content while if i enter my ip address/wordpress it's working properly.
Any solution please?

maybe you forgot to add a virtual host in http.conf. Apache restart is needed after this.
<VirtualHost *:80>
DocumentRoot "/www/example2"
ServerName www.example.org
# Other directives here
</VirtualHost>
https://httpd.apache.org/docs/2.4/vhosts/examples.html

Related

Multiple WordPress Multisite under one EC2 instance (AWS)

We are trying to to configure the DNS routing for our multisites under one EC2 instance.
Specifically we are setting up DEV, TEST, and UAT environments of a WordPress Multisite. We only just have 2 sites on this network; the main site and one network site.
Now I have successfully migrated a copy (using Duplicator Pro) of our production site (on a different EC2 instance) to our DEV and the WordPress Multisite works. We have set the wildcard entries on our route53 for this (will provide a screenshot later).
But when I migrated the same copy to TEST and UAT, the main site works but the network site is not working and only redirects to our DEV site.
Can you suggest the correct way of setting up the DNS and wildcards for this setup? Or it's not possible and should be on separate EC2 instances for each environment?
Check your setting in wp_options table for different environment. Whethere its set to dev URL or not.
select * from wp_options where option_name like 'siteurl';
OR
inside wp-config.php
define('WP_SITEURL','http://localhost/xyz');
it should be different for different environment. If possible give your URL sample.
You can use single EC2 for multiple wordpress instance. You have to set server configuration file to accept domain request under 80 or 443 port.
/etc/apache2/site-available/000-default.conf
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /var/www/html/project_name/public/
</VirtualHost>
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/html/project_name/public/
</VirtualHost>
<VirtualHost *:80>
ServerName www.abc.com
DocumentRoot /var/www/html/project_name1/public/
</VirtualHost>
<VirtualHost *:80>
ServerName abc.com
DocumentRoot /var/www/html/project_name1/public/
</VirtualHost>

Home Page Wordpress on Free MAMP does not work

I have installed MAMP (free version) on my Mac and I see the Start Page but I have a problem:
I deployed wordpress but browser say unable to connect (basically I cannot see wordpress page in browser).
In Document Root if I put a static html file I am able to see it in the browser. I am also able to see wordpress administrative pages and all other pages but home page. I have 8888 and 8889 for php and mysql ports. I do not know how to debug the issues. php, apache and mysql do not report any particular problems.
I configured virtual hosts following this guide:
http://foundationphp.com/tutorials/vhosts_mamp.php
The strange thing when I put http://localhost:8888/mywebsite in the browser it is redirected to localhost/mywebsite.
In /etc/hosts I have:
127.0.0.1 localhost
In httpd.conf I activated:
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
and in this file I have:
NameVirtualHost *:8888
<VirtualHost *:8888>
ServerAdmin myuser#gmail.com
DocumentRoot "/Applications/MAMP/htdocs"
ServerName localhost
ErrorLog "logs/mywebsite-error_log"
CustomLog "logs/mywebsite-access_log" common
</VirtualHost>
Hope someone could help.
I found the solution. After several debugging I found that this guide is correct: http://foundationphp.com/tutorials/vhosts_mamp.php
You need: 1. In /etc/hosts add your virtual hosts like:
127.0.0.1 localhost
127.0.0.1 mywebsite
before I only used localhost because I hoped to use this host in browser but I found it's required to define a new host like mywebsite.
In httpd.conf I activated:
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
In this file I have:
ServerAdmin myuser#gmail.com
DocumentRoot "/Applications/MAMP/htdocs"
ServerName mywebsite
ErrorLog "logs/mywebsite-error_log"
CustomLog "logs/mywebsite-access_log" common

Tor Hidden Service in Plesk

at first sorry for my bad english.
I am using Plesk 12 on my Ubuntu 14.04 Server. In the past i made Tor hidden services for my Domains simply whit the Apache virtual Host Files. And it Works fine.
But now i am using Plesk and now i dont understand hor to make a Exsiting Site reachable over a Hidden Service.
The Site www.example.com is available an the Host settings are :
<VirtualHost 85.214.50.74:7080 >
ServerName "example.com:80"
ServerAlias "www.example.com"
ServerAlias "ipv4.example.com"
ServerAdmin "admin#example.com"
.....
Now i added a second Virtual host :
<VirtualHost 85.214.50.74:8081 >
ServerName "xxxxxxxxxxxxxxxx.onion:80"
ServerAlias "xxxxxxxxxxxxxxxx.onion"
ServerAdmin "admin#xxxxxxxxxxxxxxxx.onion"
......
In the Torrc the Hidden service ist Corret and it generated a kex and a hostname. But if i reload Apache and Nginx and restart Tor, i cant reach the Hidden service.
You shouldn't add the onion site as a virtual host. Apache doesn't serve the requests to the .onion site directly.
Instead, edit your torrc file and add something like:
HiddenServiceDir /var/lib/tor/example.com
HiddenServicePort 8081 127.0.0.1:80
This runs a hidden service on port 8081 that proxies to port 80 on the local host. When you first start Tor it will generate all the keys and the onion address for your site which you can find in /var/lib/tor/example.com/hostname
If you have multiple virtual hosts, you might need to change the HiddenServicePort to use the hostname (or serveralias), but make sure it resolves locally so you're proxying to the local machine.

Same WordPress Website but Different Sub Domain for Mobile Version

Let say I have WP website on mydomain.com, I'm using WP plugin WP Smart Mobile to automatically convert the website to mobile version depends on the devices. It works nicely, but I want to use sub domain m.mydomain.com rather than mydomain.com IF ONLY my website in mobile version. In short, m.mydomain.com and mydomain.com refer to the same website and database, m.mydomain.com address only display for mobile users. Is it possible to do? If yes, how?
Thanks for any enlightment for this case.
additional information: I'm using linux server with apache web server.
The way that I would use it is to create a virtual host for both the domain and the mobile subdomain (the vhost file goes in /etc/apache2/sites-available) :
<VirtualHost *:80>
ServerAdmin root#mydomain.com
DocumentRoot /var/www/path/to/document/root
ServerName mydomain.com
<Directory /var/www/path/to/document/root>
AllowOverride all # allow overriding of options with .htaccess
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin root#mydomain.com
DocumentRoot /var/www/path/to/document/root
ServerName m.mydomain.com
<Directory /var/www/path/to/document/root>
AllowOverride all # allow overriding of options with .htaccess
</Directory>
</VirtualHost>
You will then need to enable the virtual host and restart apache. How to do this can vary depending on which linux distro you are using.
Once the vhosts are set up, both the domain and the subdomain will point to the same website. I'm assuming that your wordpress plugin can redirect mobile clients to the subdomain.
Update: You can use javascript to do the redirect, as long as you know that you are dealing with a mobile client.
var path = window.location.pathname,
host = window.location.host,
mobileVersion = 'http://m.' + host + path;
window.location = mobileVersion;
I also just had a thought, that the virtual host may be entirely unnecessary, as long as there is an A record for your subdomain. Sorry about that.

Possible to setup some kind of custom home DNS to reroute URLs?

Basically what I run now on my home PC is one of these WAMP in a box applications so I can write my PHP code and use a MySQL database. That is all fine, but I run a lot of websites so now I have a folder I've called /~WEBSITES/ where I put everything making the URLs to these http://localhost/~WEBSITES/domain.com/ -- what I'd like is to be able to type http://local.domain.com/ into my address bar and have it point to my local drive, but I don't want this for everyone, just me.
Possible?
NOTE: I've running Windows XP
You'll need to setup virtual hosts with Apache, and combine that with HardCode's answer (setting your hosts file). That should do what you need.
AUTHOR EDIT: Great article, here's the quick notes on what to do (at least with the most recent version of apache2triad as your WAMP installer)
Add to C:\APACHE_INSTALL_DIRECTORY\conf\httpd.conf:
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot "C:\apache2triad\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot "C:\apache2triad\htdocs\~WEBSITES\Domain1.com"
ServerName local.domain1.com
</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot "C:\apache2triad\htdocs\~WEBSITES\Domain2.com"
ServerName local.domain2.com
</VirtualHost>
Add to C:\Windows\system32\drivers\etc\hosts
127.0.0.1 localhost
127.0.0.1 local.domain1.com
127.0.0.1 local.domain2.com
Modify the text file named "hosts" found in C:\Windows\system32\drivers\etc\
Suppose you want to point www.mycustomer.com to your local host. Add in:
127.0.0.1 www.mycustomer.com
You'll need to setup virtual hosts in apache (not IIS... oops), and combine that with HardCode's answer. That should do what you need.

Resources