Wildcard and automatic subdomains - wildcard

I was browsing the internet and I do not know what's going on anymore.
I have a vps with Centos webpanel, on vps is a script that is supposed to automatically create subdomains for users who want to add their business card.
Domain in OVH, I added in the dns zone entry: * .mysite.eu A IP vps.
File /usr/local/apache/conf.d/vhosts.conf
ServerName myserver
ServerAlias *.mysite.eu
ServerAlias www.mysite.eu
ServerAdmin webmaster#mysite.eu
DocumentRoot /home/lupus/public_html
UseCanonicalName Off
ScriptAlias /cgi-bin/ /home/lupus/public_html/cgi-bin/
# Custom settings are loaded below this line (if any exist)
# Include "/usr/local/apache/conf/userdata/lupus/mysite.eu/*.conf
<IfModule mod_userdir.c>
UserDir disabled
UserDir enabled lupus
</IfModule>
<IfModule mod_suexec.c>
SuexecUserGroup lupus lupus
</IfModule>
<IfModule mod_suphp.c>
suPHP_UserGroup lupus lupus
suPHP_ConfigPath /home/lupus
</IfModule>
<Directory "/home/lupus/public_html">
AllowOverride All
</Directory>
When trying to create a business card, the address is: https: //mysite.eu/company/%26nbsp%3B (after these strange characters, I can enter the name of the company)
And it should be: https: //company/mysite.eu
What is wrong?

I have already sent a feature request to CWP team for this feature.
Anyhow, for the time being now, you can create wildcard subdomain through this code. Paste this code at the end of /usr/local/apache/conf.d/vhosts.conf file through SSH or file manager
# vhost_start *.yourdomain.com
ServerName _wildcard_.yourdomain.com
ServerAlias *.yourdomain.com
ServerAdmin hostinpk#gmail.com
DocumentRoot "/home/yourdoma/public_html"
ErrorLog "/home/yourdoma/public_html/error.log"
ScriptAlias /cgi-bin/ /home/yourdoma/public_html/cgi-bin/
# Custom settings are loaded below this line (if any exist)
# Include "/usr/local/apache/conf/userdata/yourdoma/*.yourdomain.com/*.conf
SuexecUserGroup yourdoma yourdoma
suPHP_UserGroup yourdoma yourdoma
<Directory "/home/yourdoma/public_html">
AllowOverride All
# vhost_end *.yourdomain.com
Don't forget to replace yourdomain.com with your own domain name and yourdoma with the user name of the account.
Save the file and start using wildcard subdomains on your account.

Related

Stop https and ServerName redirection apache2

my issue is simple I want to access http://tunisie-telegraph.com but it redirects me to https://tunisietelegraph.com
my domain name dns are ns1.digitalocean.com, ns2.digitalocean.com, ns3.digitalocean.com
I have 2 "A" and 2 "AAAA" records (with www and without)
I've deleted the .htaccess file
my virtual host file:
# Added to mitigate CVE-2017-8295 vulnerability
UseCanonicalName On
<VirtualHost *:80>
ServerAdmin private#gmail.com
ServerName tunisie-telegraph.com
ServerAlias www.tunisie-telegraph.com
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
can you please check Site URL & Home URL in wp_options table. Might be URL is different over there in one of the column because when i have added the url like this https://tunisietelegraph.com/wp-login.php it's not redirecting
Or you can set the Site URL & Home URL from wp_config.php as well
define( 'WP_HOME', 'http://tunisie-telegraph.com' );
define( 'WP_SITEURL', 'http://tunisie-telegraph.com' );

wordpress site working locally but not from the domain

My wordpress site is working locally in my wamp server, this is hosted on an ec2 instance and domain is maintained in Route 53\cloudfare. The domain is working when i checked it using mxtoolbox. The site was working and live till the time i changed my host file in the server. I removed the host file entries accidentally thinking it is a dev site, however i restored it but still the site is not working and i am getting only the "TOO MANY REDIRECTS" error. The following is the current windows host file details
#
127.0.0.1 localhost
::1 localhost
127.0.0.1 mydomain.com
::1 mydomain.com
I restarted the server and WAMP multiple times but it is not working.
The following is my virtualhost configuration
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
#
<VirtualHost *:80>
ServerName mydomain.com
DocumentRoot "c:/wamp/www/sitefolder"
<Directory "c:/wamp/www/sitefolder/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.mydomain.com
DocumentRoot "c:/wamp/www/sitefolder"
<Directory "c:/wamp/www/sitefolder/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride all
Require all granted
</Directory>
</VirtualHost>`
Clean your cache and browser history first, then try doing it below:
Open your wordpress admin panel --> Settings--> General --> Make sure it points to the correct domain. --> Save
Or go to the wp-config.php file (Try this if the first method fails / can't be accessed)
add:
define('WP_HOME','http://YourDomain.com');
define('WP_SITEURL','http://YourDomain.com');
or
Try to remove or rename default .htaccess
or
Try to disable the plugin (renaming the plugin folder in the "wp-content/plugin/plugin-folder-name" will non-active that plugin. This might solve the problem if the constraints are due to the plugin)
That's a number of ways when I resolve the ERR_TOO_MANY_REDIRECTS problem. Goodluck

Bad Gateway, Drupal, Redmine via VM centos to host windows

I have one VMs CentOS inside I have installed drupal and redmine. I did my redmine.conf and drupal.conf. But when I want to open the browser on my I have Bad Gateway error. And I don't understand.
Here my .conf files:
redmine:
LoadModule passenger_module /home/flaman-m/.gem/ruby/gems/passenger-5.0.10/buil$
<IfModule mod_passenger.c>
PassengerRoot /home/flaman-m/.gem/ruby/gems/passenger-5.0.10
PassengerDefaultRuby /usr/bin/ruby
</IfModule>
<VirtualHost *:80>
ServerAdmin morgane
ServerName srvb.quest-etna.nx
DocumentRoot /opt/redmine/public
#PassengerEnabled on
#RailsEnv production
ErrorLog /mnt/nfs/logs/redmine/error.log
CustomLog /mnt/nfs/logs/redmine/access.log combined
<Directory /mnt/nfs/logs/redmine>
DirectoryIndex index.php
Options FollowSymLinks MultiViews
Require all granted
AllowOverride All
Order deny,allow
allow from all
</Directory>
</VirtualHost>
here drupal:
<VirtualHost *:80>
ServerName drupal.flaman-m-quest-etna.nx/
ServerAdmin morganeflamant#gmail.com
DocumentRoot /opt/drupal
DirectoryIndex index.php
ErrorLog /mnt/nfs/logs/drupal/error.log
CustomLog /mnt/nfs/logs/drupal/access.log combined
LogLevel warn
<Directory /mnt/nfs/logs/drupal>
Require all granted
AllowOverride All
Order deny,allow
allow from all
</Directory>
</VirtualHost>
and here my hosts windows :
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handle within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
192.168.31.138 srva.flaman-m-quest-etna.nx
192.168.31.128 srvb.quest-etna.nx
192.168.31.128 drupal.flaman-m-quest-etna.nx
192.168.31.139 datas.flaman-m-quest-etna.nx
Do you know if something is wrong ? Thank you.
I found it, this is not the best way but I disabled my firewalld in CentOS and it works.
sudo service disable firewalld
sudo service stop firewalld
You can just configure it too to make it works.

Drupal vhost file not displaying website content

I have used virtualhost file in drupal to create multiple sites under one server. Also to remove /drupal from the url.
ex: 202.45.198.98/drupal this is how my URL looks like when ever I visit my website
After creating new Virtual host file for my website, I can see my website without /drupal in url.
Now the problem only the first page is loaded I mean some matter but not images, drupal template or any other links.
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName mysite
DocumentRoot /var/www/drupal
<Directory /var/www/drupal/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory /var/www/drupal/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin/">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
You should check the settings.php inside sites/default folder. You will see a line something like --
# $base_url = 'http://www.example.com'; // NO trailing slash!
Remove the hash at the start & update the URL with the current URL you have for the drupal instance. Most probably you will solve your problem if your connection setting is correct at the same settings.php file (DB name, server name, username & password).
If you find problem due to clean URL in logging in then you may have to put manual path for logging in as admin, which will be --
YOUR_BASE_URL/?q=user/login
If you want to disable clean URL then you can write a extra line in your settings.php --
$conf = array(
'clean_url' => 0,
);
Have nice drupling :)

www being served on iis, non-www being served on apache?

Here is the problem, if you visit the site directorybest.net you will see the correct website (which is defined in apache). But if you go to the www version of the site a catch all site for and from IIS is displayed. I have no idea what this is causing this.
I have another site that already runs fine on apache from which I copied the info for DNS and vhost settings. I also have set the DNS up so that both sites point to the same ip address. Does anyone know why the www version of the site does not show the right website?
Here is the vhost information for both the working and non working site.
NameVirtualHost *
#non-working site
<VirtualHost *>
ServerAdmin admin#email.com
ServerName www.directorybest.net
ServerAlias directorybest.net *.directorybest.net
DocumentRoot "D:\WWW\DirectoryBest\2"
DirectoryIndex index.php
<Directory D:\WWW\DirectoryBest\2>
AllowOverride All
</Directory>
# Logfiles
ErrorLog D:\WWW\DirectoryBest\2\logs\error.log
CustomLog D:\WWW\DirectoryBest\2\logs\access.log combined
</VirtualHost>
#working site
<VirtualHost *>
ServerAdmin admin#email.com
ServerName www.directorybest.info
ServerAlias directorybest.info *.directorybest.info
DocumentRoot "D:\WWW\DirectoryBest\1"
DirectoryIndex index.php
<Directory D:\WWW\DirectoryBest\1>
AllowOverride All
</Directory>
# Logfiles
ErrorLog D:\WWW\DirectoryBest\1\logs\error.log
CustomLog D:\WWW\DirectoryBest\1\logs\access.log combined
</VirtualHost>
Ok so I was just informed that the company has had DNS problems before. And upon further checking the local DNS had not been updated and was still resolving to the old ip address.

Resources