Same common name for multiple SSL's - ssl

I am using CentOS 7.4 and Certbot version 0.22.2
I have around 30 websites configured with Apache on single server and for them when I run command
sudo certbot --apache
it asks me for 'Which names would you like to activate HTTPS for?' and then I type in 1,2,......,30 all the number of websites.
All goes fine and it installs SSLs on all websites, but for some reason the common name for each website remains one and that is of the very first website. Is it something what we called the base domain or what? and how can we avoid it and make sure that each website name displaying on browser should also be separate?

Related

How to create multiple website using one IP adress (apache2)

I installed ubuntu server 16.10 on VirtualBox recently in order to host a website on it thanks to apache2.
I followed some tutorials to do it, but here's the issue : it doesn't work :/
I mean, when I use ifconfig, I get the following IP : 10.41.175.36
If I type this IP in the URL, I get the default html page for apache. So this is good, I guess, I'm able to access this webpage from any devices if they're connected to the same wifi.
Now I want to create 2 websites on my ubuntu server, I created one index.html in /var/www/site1 and one in /var/www/site2, I configured the .conf in /etc/apache2/sites-available for the 2 websites, I restard the apache2 and enabled the websites.
Now, I tried to enter the domain name I gave them but It tells me that the URL isn't known.
I edited the /etc/hosts to change domain name and it doesn't work.
So do you have a tip or a tutorial in order to create the websites ?
I hope I was clear, thank you.
You should check out VirtualHosts on Apache2. https://httpd.apache.org/docs/2.4/vhosts/examples.html

apache2: subdirectory won't work if I enable app at /

I built a personal server at home which is hosted at, let's say, example.org and I installed GitLab as a subdirectory so I can access to it at example.org/gitlab. As GitLab is the only one application I have so far, everything works smoothly.
Now I want to have a blog at root, so I enabled Apache default site to do some tests. I can see apache2 default page at example.org (which is where I want my blog) but GitLab won't work anymore at example.org/gitlab. All I have is a "page not found". GitLab will only work if I disable the default page at /.
I tried using Alias, I also read something about redirections but I haven't managed to make example.org and example.org/gitlab work together so far.
Any advice about where to look, please?
If you generate two virtualhosts both must have different ServerName, otherwise first match receives all requests and second virtualhost will be ignored.

Changing hostname of VPS - ZPanel Issue

Basically I've got a VPS setup but I incorrectly set the hostname. I left it for a while and it was fine, installed zpanel etc and now it's a 'web host' and everything was fine. Now I want to change the hostname so I logged into the hosting companies control panel for the server and changed the hostname.
The original and the new hostname are in the format of xxx.yyy.com. So nothing happend and I could still reach the zpanel login page via the 'old' host name even though in the hosting companies control panel it said it had changed.
For ease of explanation, we shall say my old hostname was xyz.example-domain.com and my new is server.another-domain.com. Both domains are controlled within this installation of zpanel.
Anyway. I deleted the dns entry for "xyz" on example-domain and, as you would expect, if you go to xyz.example-domain.com you get nothing. I created a dns A record for server.another-domain.com but now all you get is the default apache 'welcome to your server' page. To get to zpanel login, you need the IP address.
SO my question is, do I need to do something else? It seems that I need to change where this zpanel login page is getting displayed so that it can be server.another-domain.com. I'm guessing there is some file somewhere that I need to edit but I don't know what one and "the internet" isn't really helping as all I find is 'change the host name in the hosting companies control panel' which I've done.
PS It is an apache 2 server running CentOS 6
Take a look at your Apache configuration located in /etc/httpd/conf/httpd.conf. If you intend on running multiple domains off the same host, you'll need to setup Virtual Hosts. You'll see a detailed explanation of those settings toward the bottom of your configuration file.
Depending on where you've located your files, you'll want to set your DocumentRoot accordingly for each of your Virtual Hosts, and that will instruct Apache to look for the files in the proper places. By default, I believe it looks in /var/www.
NOTE: You will need to restart Apache or reload configurations whenever you alter your configuration file. You can do this by running either one of the following commands (as root):
/etc/init.d/httpd restart
/etc/init.d/httpd reload
Go to /etc/zpanel/panel/
rename: index.php -->panel.php (or any other name).
Then create index.php and let it in blank (or write a welcome message)
Finally enter to your zpanel like this: http://www.yourIP/panel.php
Works fine!
Is not necessary change any port

Cannot install Wordpress Multisite (Network) on a custom port

I'm running a website at http://localhost:8080/sitename. However, when I'm trying to create a network of sites with wordpress, I'm getting the following error under Tools-> Network:
ERROR: You cannot install a network of sites with your server address.
You cannot use port numbers such as :8080.
I tried to create a virtual host and a fake domain but I can't make it work.
How can I solve that?
At this moment, Wordpress only seem to support 80 and 443 ports. A temporary possible workaround to use any custom (i.e. http 8080) port:
Open wp-admin/includes/network.php and find the section of code where it mentions array( ':80', ':443' ) and add :8080 too in that array.
After completing setup of network, you might need in wp-config to adjust to such:
define( 'DOMAIN_CURRENT_SITE', 'example.com'. (stristr($_SERVER['PHP_SELF'],'wp-login.php') ? '':':8080') );
As noted in comments (thanks) after creating first sub-site, it might have port number embedded in domain name, so try to enter Mysql Database (i.e. try hosting's phpMyAdmin, or even installed plugin before starting procedure) and in _blogs & _site& _options tables, to adjust homepage urls of subsites(i.e. separate port number from domain).
That's all. Login again to your project.
From my experience, WP is not designed to use custom ports for multi-sites so the blogs (sub-sites) hosts get messed up in the DB.
My solution: After you switch to multi-site or create a new site, you need to go to your db admin page (e.g. phpMyAdmin) and fix the blogs domain in the wp_blogs table. Basically WP failed to add a colon between the host and port; just have to add it-> localhost8080 becomes localhost:8080.
So, on the site's settings add the missing colon to the siteurl and home urls.
I found temporary solution:
running "netstat -o -n -a | findstr 0.0.80" in CMD will show you wich service is using the port 80. If PID is 4 it means that port 80 is used by the system (propably IIS or web matrix if it is installed - this was my case). i changed the port IIS was using from IIS Manager and i also deactivated MsDepSvc service (Web Matrix) which was also using port 80. After that i reconfigured apache to work in port 80 and everything worked OK!

Settings nginx - users and rights

I wonder whether it is possible to force nginx to use some user/group for each given domain? It seems that nginx is able to run only as one given user for all the domains – in Apache I run each domain as a different user.
For static files, you don't need to do anything about user rights. The nginx user will serve these. The same applies to Apache btw, it runs normally as User "apache" in Group "apache".
it is in PHP that you need to set user details and this depends on how you run PHP with Nginx.
Nginx does not run PHP directly as Apache does and simply hands PHP requests to another separate process. This can be Apache as proxy or FastCGI using FPM etc. Whatever process it is that runs PHP is where the user issues have to be handled.
If serving as proxy to Apache, you set Apache up as you indicate and that is that. If FastCGI using FPM, then it will be in PHP FPM. Each pool conf file accepts "user" and "group". To make this work for multiple domains, you just need to make one fpm pool per domain and each would listen on a different port.
So Domain 1 can be on Port 9001, Domain 2 or 9002 etc. Each will have a separate user and group as required.