How to trace site route in apache - wordpress

UBUNTU + APACHE
I am running a few wordpress sites on one server (that I inherited) using VirtualHosts, and I need to configure ssl certificates for each site.
Before starting to set up certificates for each site, I tried entering each domain with the https prefix on the browser and noticed it redirects me to a site (with an invalid certificate) that is supposed to be disabled and does even show up when I run
apachectl -t -D DUMP_VHOSTS
I tried configuring the virtualhost entries for one of the sites with the valid certificate and it still goes to same old site. How can I completely disable and remove that site and the invalid certificate? I cannot find it anywhere on the server.
My Virtual host looks something like this
NameVirtualHost *:443
<VirtualHost *:443>
ServerName www.yoursite.com
DocumentRoot /var/www/site
SSLEngine on
SSLCertificateFile /path/to/www_yoursite_com.crt
SSLCertificateKeyFile /path/to/www_yoursite_com.key
SSLCertificateChainFile /path/to/DigiCertCA.crt
</VirtualHost>

If you want to disable a virtual host configuration you just need to do:
sudo a2dissite sitename
sudo systemctl restart apache2
and the issue should be resolved

Related

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.

Can't find deployed app

I deployed my first meteor app on a digital-ocean droplet using mup. So it's there but I can't figure out what I still have to setup to actually view my app. So when I go to www.example.com I should see it but all I see is an apache page.
When you start a Meteor app, you can specify the port for it to listen on using the --port argument. For it to be available from at you domain name specify port 80. Though if you have Apache listening on that port already it will fail to bind to it. Uninstall or stop Apache, and restart your Meteor app.
If you are using Apache to serve other content and can not stop it, you'll need to have your Meteor run on a different port with an Apache ProxyPass. First enable mod_proxy and mod_proxy_http
sudo a2enmod proxy proxy_http
Then create a new VirtualHost for the Meteor app that proxies request to the port you have decided to have it listen on. It will look something like:
<VirtualHost *:80>
ServerName www.example.com
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
See this article for all the details.

Vagrant "domain forwarding"

Currently, I've got used to creating development domains like: projecttowork.dev.
Now I have a project, where I have to use subdomains as well, so like: module1.project.dev
I would like to start using Vagrant, because it looks awesome and I work together with some other people, and it would be great to have the same server everywhere.
In Vagrant, of course I can forward a port, like :8000 and get the server on virtual machine, but I can not figure out, how to "forward" a domain.
I tried different ways, but without any success.
Some details:
OS: Windows 8
Vagrant box: basic Ubuntu 12.04 LTS
Webserver on client: Nginx
Webserver on host: Apache (if needed)
How could I redirect this development domain to the virtual server?
-My settings in Vagrant file for network is:
config.vm.network "private_network", ip: "192.168.20.20" #choose you own
-In the host machine in /etc/hosts (linux) Windows/system32/driv.../hosts (windows)
192.168.20.20 domain.tld
-On the box check firewall (iptables - if the box is linux).
either deactivate your firewall on the box(I did this) or setup it to allow access from the host machine. (http://www.cyberciti.biz/tips/linux-iptables-examples.html)
-In the box set virtualhost for this domain (just an example):
<VirtualHost *:80>
ServerName domain.tld
DocumentRoot "/path"
RewriteEngine On
<Directory "/path">
Options Indexes FollowSymLinks
</Directory>
</VirtualHost>
Did you use etc/hosts file before to point dev domains to your dev machines IP? Same way, just add 1 row per subdomain to point them to you vagrant box IP, for example:
module1.project.dev 192.168.1.2
module2.project.dev 192.168.1.2
...

EC2 AWS SSL issue in Wordpress for load assets

I have a wordpress blog in AWS that uses http.
Now I instaled a SSL certificate so I can use https.
All http://www.mysite.com works fine. All content loads and is perfect.
When I use https://www.mysite.com, all assets (images, css, js,..) are not loaded and got a console error that the server can't find in https.
Does anyone know a possible solution for this?
Installed mod_sll, restarted Apache, update yum, open port 443.... But nothing.
Thanks in advance
Seems like you didn't properly setup the SSL virtual host. if you use default ssl.conf in apache, make sure you add ServerName and ServerAlias accordingly.
If it still didn't work. Please backup your ssl.conf first and delete all the lines below
## SSL Virtual Host Context in ssl.conf and put following content in ssl.conf or as a new file in sites-enabled if you're using debian based.
Also dont forget to run netstat -nltp and see if port 443 is listing by apache. If not add listen 443 in your httpd.conf or ssl.conf
<VirtualHost *:443>
SSLEngine on
SSLProtocol -ALL +SSLv3 +TLSv1
SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:!LOW:!SSLv2:!EXPORT
## /etc/httpd/ssl/ replace with the directory which contains your PrivateKey,
## Certificate and Bundle file(if available)
SSLCertificateFile /etc/httpd/ssl/ssl.crt/your_domain.crt
SSLCertificateKeyFile /etc/httpd/ssl/ssl.key/your_domain.key
SSLCACertificateFile /etc/httpd/ssl/ssl.crt/bundle.crt
ServerName yourdomain.com
ServerAlias www.yourdomain.com
ServerAdmin youremail.com
DocumentRoot /var/www/yourdomain.com/htdocs
php_admin_value open_basedir "/var/www/yourdomain.com/htdocs"
<Directory "/var/www/yourdomain.com/htdocs" >
Options -Indexes FollowSymLinks
allow from all
AllowOverride All
</Directory>
CustomLog /var/log/httpd/yourdomain-access_log combined
ErrorLog /var/log/httpd/yourdomain-error_log
</VirtualHost>

Wordpress Apache Vhost Example

I'm trying to install wordpress but i'm confused as to how the Apache Vhost should look.
Ideally i'm after a vhost setup that adds additional security (make sure referrer is correct when doing comments)
I cant seem to find this anywhere (i'm not the best searcher)
It's pretty straight forward
from http://ubuntuforums.org/showthread.php?t=794248:
create a new site(vhost) configuration at /etc/apache2/sites-available/ (replace with whatever you want besides default) something like this should work
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /path/to/new/site
ServerName www.example.com
</VirtualHost>
enable your new site
sudo a2ensite <site name>
restart apache to listen on your new port and load your new site
sudo /etc/init.d/apache2 restart
This guide for vhosts using mamp will help you with the setup! This saved me a lot of time.

Resources