CWP Account's Subdomains on Main Domain - linux

I was surfing on the internet and I don't know what's going on anymore.
I flipped across Google ;)
How to setting my VPS for all user's accounts? Could you help me?
Example:
Server "top" domain: srv1.myserver.com
Customer domain: ubuntu001.com (now it's OK: www.myserver.com/~ubuntu001)
Customer domain: garfield.net (now it's OK: www.myserver.com/~garfield)
I need this "format":
ubuntu001.myserver.com OR ubuntu001.com.myserver.com
garfield.myserver.com OR garfield.net.myserver.com
How to config my CWP VPS (apache vhosts)?
Thank you for all the guidelines.
UPDATE:
Edit this conf file:
/usr/local/apache/conf.d/vhosts/myserver.com.conf
Add "ServerAlias" for VirtualHost block
Restart Apache service on server
<VirtualHost 1.2.3.4:80>
ServerName ubuntu001.com
ServerAlias www.ubuntu001.com
ServerAlias ubuntu001.myserver.com
ServerAlias www.ubuntu001.myserver.com
ServerAdmin webmaster#ubuntu001.com
DocumentRoot /home/ubu001/public_html
[...]
<IfModule mod_setenvif.c>
SetEnvIf X-Forwarded-Proto "^https$" HTTPS=on
</IfModule>
<Directory "/home/ubu001/public_html">
Options -Indexes -FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
[...]
</VirtualHost>
I's OK: http://ubuntu001.myserver.com
I's not working: httpS://ubuntu001.myserver.com
(the myserver.com is an example domain)

Related

How to provision httpd.conf for SSL configuration if I want to visit by https?

I have just configured my server with an open-source ALM tool, e.g. ZenTao. Now I need to edit httpd.conf to visit it through my domain with https, but I don't know-how, could someone help with that?
I am using Ubuntu 18.04 LTS (GNU) and I have already applied for a certificate for my domain from Letsencrypt.
If you want to make your https work for your ZenTao domain, you should provision your httpd.conf with port 443 details, which you could refer to the following,
DocumentRoot and Directory should be your /zentao/www root,
And you should configure with your SSL certificates in it as well,
<VirtualHost *:443>
ServerName *.xxx.com
ServerAlias *.xxx.com
DocumentRoot "/zentaoalm/www/"
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/xxx.com.crt
SSLCertificateKeyFile /etc/apache2/ssl/xxx.com.key
SSLCertificateChainFile /etc/apache2/ssl/xxx.com.pem
<Directory "/zentaopms/www">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

Configure Apache reverse proxy and regular virtual host

I've read several posts like mine, but none of them seem to work.
I've got a regular apache config on CentOS 7 with a working website, both HTTP and HTTPS (certbot).
I have another service with a web port of `:3000 and i'd like to have it work as such:
http(s)://example.com (regular website content)
http(s)://example.com/new_site (the service on port 3000)
I've got the website set up as a virtual host with a custom webroot in /var/www/example.com/docroot
This is my current working config. I realized that the connection between the localhost does not need to be HTTPS, just the incoming requests:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName example.com
ServerAlias www.example.com
ProxyPass /my_site http://localhost:3000
ProxyPassReverse /my_site http://localhost:3000
ErrorLog /var/log/httpd/my_vhost_log
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
</VirtualHost>
</IfModule>
I also cleared up permissions issues by enabling the httpd_can_network_connect SELinux boolean.
UPDATE:
My issue now is that the above config overwrites my regular website content, so if you go to the https://example.com, it will just show the Apache welcome page, rather than the content in the /var/www/example.com/docroot.
Main config:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/docroot
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
</VirtualHost>
</IfModule>
In the event that anyone comes across this,
The fix is simply to add the Proxy lines to your main domain config. You only need a single config file.

Apache VirtualHost Setup on QNAP for Sub Sirectories

I am trying to setup vHost on my QNAP web server (Running Apache). I seem to be stuck at the point where I can't load the subdomains. I have included a custom conf file in the apache.conf file like so:
include /share/Web/customapache.conf
In the customapache file, I have the following:
NameVirtualHost *:80
ServerName 127.0.0.1
DocumentRoot "/share/Web/site1-home"
<Directory />
Order deny,allow
Deny from all
</Directory>
ServerSignature Off
ServerTokens Prod
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
# ServerAlias www.localhost
DocumentRoot "/share/Web/site1-home"
<Directory "/share/Web/site1-home">
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName pods.localhost
# ServerAlias www.pods.localhost
DocumentRoot "/share/Web/site2-pods"
<Directory "/share/Web/site2-pods">
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
It's probably a bit of a mess as I have been trying multiple different examples trying to fix whatever issues I have. I am fairly new to linux, and apache to be honest. I was able to get it all working fine in NGINX, however I ran into some compatability issues with QNAP.
Essentially, the main redirect is working, so that the base directory is now /share/Web/site1-home, but the subdomain is not working (pods.localhost). I am sure its something simple I am missing, or even something I have added that I do not need. But any assistance, or even a point in the right direction would be much appreciated.
Regards
Kirt

Resolving virtual hosts apache 2

I'm trying to setup my apache server to access certain folders when I type addresses like test1.example.com test2.example.com etc.
So far I read and did many things but with no success yet. I'll be very thankful if you can help me.
So to start I'm using ubuntu 12.10 as my desktop and I've set up apache server there. I've added example.com in hosts resolving to 127.0.0.1. So far no problems. I've enable vhost_alias and mod_rewrite in apache and I'm using this for my virtual server
NameVirtualHost *:80
UseCanonicalName Off
<VirtualHost *:80>
ServerName example.com
ServerAlias *.example.com
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?([^\.]+).example.com$
RewriteRule ^(.*) $1 [F]
VirtualDocumentRoot /home/example/server/projects/%1/public_html
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
<Directory /home/radoslav/server/projects>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
#log file for this server
CustomLog /var/log/apache2/example.com.log combined
</VirtualHost>
But when I open test.example.com it says that browser can find test.example.com, no matter that I have this directory in the path specified. Just to clear things up apache have permissions to read this directory so it's not this. When I ping example.com from console I get ping but if I ping test.example.com I get error that can not find host. As you can see obviously it's not resolving the adress no matter that I've setup everything correcly.
Any help guys?
You need to add test.example.com and any other hostnames you want to use in the host file. The host file does not supports wildcard.

Secure page with SSL in Apache and Document Root

i created the certificates with OpenSSL for use in localhost.
Fine, but when I set VirtualHost in Apache, if I set DocumentRoot the page is loaded normal, without a different mark in address bar.
When I don't specify a DocumentRoot, the Firefox load the Xampp page, but with secure mark in adress bar.
My actual Vhost is:
<VirtualHost *:443>
SSLEngine On
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
ServerName www.agurbana.com.br
SSLCertificateFile "E:/agenda.crt"
SSLCertificateKeyFile "E:/server_unsecured.key"
SSLCACertificatePath "E:/"
SSLCACertificateFile "E:/ca.crt"
<FilesMatch "\.(cgi|shtml|pl|asp|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
DocumentRoot "E:/SITES/AU2/"
ErrorLog "E:/error.log"
<Directory "E:/SITES/AU2/">
AllowOverride All
Allow from All
</Directory>
BrowserMatch ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
</VirtualHost>
how I can do appear a secure mark in address bar when i set up DocumentRoot?
By chance, do you also have a vhost set-up to listen to port:80 in your httpd-vhosts.conf file?
In that case, the scheme will be determined by the user, not by the server. You can get rid of the :80 listener, but now the user has to remember to type https, which is bad. Therefore use Apache re-directs to force usage of SSL, e.g. http://www.cyberciti.biz/tips/howto-apache-force-https-secure-connections.html

Resources