I've created a wildcard subdomain using cpanel and attempting to point all sub domains to a particular .wsgi file.
<VirtualHost my.server_ip.address:9999>
ServerName _wildcard_.domain.tld
ServerAlias *.domain.tld
# DocumentRoot /home/my_acct/public_html
ServerAdmin webmaster#domain.tld
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/_wildcard_.domain.tld combined
CustomLog /usr/local/apache/domlogs/_wildcard_.domain.tld-bytes_log "%{%s}t %I .\n%{%s}t %O ."
## User my_acct # Needed for Cpanel::ApacheConf
UserDir enabled my_acct
<IfModule mod_suphp.c>
suPHP_UserGroup my_acct my_acct
</IfModule>
<IfModule !mod_disable_suexec.c>
<IfModule !mod_ruid2.c>
SuexecUserGroup my_acct my_acct
</IfModule>
</IfModule>
<IfModule mod_ruid2.c>
RMode config
RUidGid my_acct my_acct
</IfModule>
<IfModule itk.c>
# For more information on MPM ITK, please read:
# http://mpm-itk.sesse.net/
AssignUserID my_acct my_acct
</IfModule>
ScriptAlias /cgi-bin/ /home/my_acct/public_html/cgi-bin/
# To customize this VirtualHost use an include file at the following location
Include "/usr/local/apache/conf/userdata/std/2_2/my_acct/wildcard_safe.domain.tld/*.conf"
</VirtualHost>
The following code is what is in wildcard_safe.domain.tld/*.conf and there is only 1 .conf which I name it as subdomain.conf
SetEnvIf Host "^(\w+).domain.tld" subdomain=$1
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess pyramid_subdomain user=my_acct group=my_acct threads=4 \
python-path=/home/my_acct/modwsgi/env/lib/python2.6/site-packages
WSGIScriptAlias / /home/my_acct/modwsgi/env/pyramidsub_%{ENV:subdomain}.wsgi
WSGIScriptAlias /admin /home/my_acct/modwsgi/env/pyramidsub_%{ENV:subdomain}.wsgi
<Directory /home/my_acct/modwsgi/env>
WSGIProcessGroup pyramid_subdomain
Order allow,deny
Allow from all
</Directory>
The following is the pyramidsub_test.wsgi file
from pyramid.paster import get_app, setup_logging
ini_path = '/home/my_acct/modwsgi/env/MyFirstApp/production_subtest.ini'
setup_logging(ini_path)
application = get_app(ini_path, 'main')
I've also ensured that there's a pyramidsub_test.wsgi in /home/my_acct/modwsgi/env/.
After setting all this up, I did a apache restart, and go to test.mydomain.com.
However it is showing a website not found, I've checked on apache error_log, but I can't
find any errors being logged. However, I have no problem viewing the main
domain ( www.domain.com )
This is my first time doing server setup, etc, coming from a php background.
Any help is much appreciated.
Related
I tried all the ways I knew, But...
Let me explain with an example what I want.
I have a blog service, with main domain and many domain pointers and subdomains.
Main domain: blog.com
Subdomains: sub1.blog.com, sub2.blog.com, sub3.blog.com and....
Domain pointers : domain1.com , domain2.com, domain3.com and...
Every domain redirect to a spacial subdomain with Php code
But, what is the problem?
When i add a Subdomain (for exapmle sub2.blog.com) to Sub Domains, in user httpd.conf create VirtualHost settings for All domain pointers (sub2.domain1.com, sub2.domain2.com, sub2.domain3.com and...) ... But i don't want it!!!
And what is the big problem ???
for example if i had 600 domain pointer, with create 500 subdomains, httpd add 3000000 (500x600) VirtualHost settings to user httpd.conf file. and httpd.conf file size will be very large.
What will be the result?
A big time needed to create httpd.conf file
Server load coming to very High
Apache server Crash
And...
I want Subdomain VirtualHost just create for Main Domain (sub2.blog.com) , not for Domain Pointers... I don't need sub2.domain1.com or others...
What can i do for this ? Help me Guys
Can I change rewrite_confs script to do what i want it?
Or any way....???
Here the VirtualHost settings that happened to me:(
<VirtualHost 88.88.88.88:80 >
ServerName www.sub1.domain1.com
ServerAlias www.sub1.domain1.com sub1.domain1.com
ServerAdmin webmaster#blog.com
DocumentRoot /home/blog/domains/blog.com/public_html/sub1
UseCanonicalName OFF
<IfModule !mod_ruid2.c>
SuexecUserGroup blog blog
</IfModule>
CustomLog /var/log/httpd/domains/blog.com.sub1.bytes bytes
CustomLog /var/log/httpd/domains/blog.com.sub1.log combined
ErrorLog /var/log/httpd/domains/blog.com.sub1.error.log
<Directory /home/blog/domains/blog.com/public_html/sub1>
AllowOverride AuthConfig FileInfo Indexes Limit Options=Indexes,IncludesNOEXEC,MultiViews,SymLinksIfOwnerMatch,FollowSymLinks,None
Options -ExecCGI -Includes +IncludesNOEXEC
<FilesMatch "\.(inc|php|phtml|phps|php56)$">
<If "-f %{REQUEST_FILENAME}">
#ProxyErrorOverride on
AddHandler "proxy:unix:/usr/local/php56/sockets/blog.sock|fcgi://localhost" .inc .php .phtml .php56
</If>
</FilesMatch>
</Directory>
</VirtualHost>
<VirtualHost 88.88.88.88:80 >
ServerName www.sub1.domain2.com
ServerAlias www.sub1.domain2.com news.domain2.com
ServerAdmin webmaster#blog.com
DocumentRoot /home/blog/domains/blog.com/public_html/sub1
UseCanonicalName OFF
<IfModule !mod_ruid2.c>
SuexecUserGroup blog blog
</IfModule>
CustomLog /var/log/httpd/domains/blog.com.sub1.bytes bytes
CustomLog /var/log/httpd/domains/blog.com.sub1.log combined
ErrorLog /var/log/httpd/domains/blog.com.sub1.error.log
<Directory /home/blog/domains/blog.com/public_html/sub1>
AllowOverride AuthConfig FileInfo Indexes Limit Options=Indexes,IncludesNOEXEC,MultiViews,SymLinksIfOwnerMatch,FollowSymLinks,None
Options -ExecCGI -Includes +IncludesNOEXEC
<FilesMatch "\.(inc|php|phtml|phps|php56)$">
<If "-f %{REQUEST_FILENAME}">
#ProxyErrorOverride on
AddHandler "proxy:unix:/usr/local/php56/sockets/blog.sock|fcgi://localhost" .inc .php .phtml .php56
</If>
</FilesMatch>
</Directory>
</VirtualHost>
<VirtualHost 88.88.88.88:80 >
ServerName www.sub1.domain3.com
ServerAlias www.sub1.domain3.com sub1.domain3.com
ServerAdmin webmaster#blog.com
DocumentRoot /home/blog/domains/blog.com/public_html/sub1
UseCanonicalName OFF
<IfModule !mod_ruid2.c>
SuexecUserGroup blog blog
</IfModule>
CustomLog /var/log/httpd/domains/blog.com.sub1.bytes bytes
CustomLog /var/log/httpd/domains/blog.com.sub1.log combined
ErrorLog /var/log/httpd/domains/blog.com.sub1.error.log
<Directory /home/blog/domains/blog.com/public_html/sub1>
AllowOverride AuthConfig FileInfo Indexes Limit Options=Indexes,IncludesNOEXEC,MultiViews,SymLinksIfOwnerMatch,FollowSymLinks,None
Options -ExecCGI -Includes +IncludesNOEXEC
<FilesMatch "\.(inc|php|phtml|phps|php56)$">
<If "-f %{REQUEST_FILENAME}">
#ProxyErrorOverride on
AddHandler "proxy:unix:/usr/local/php56/sockets/blog.sock|fcgi://localhost" .inc .php .phtml .php56
</If>
</FilesMatch>
</Directory>
</VirtualHost>
I have a server setup using Centos 7 and the Centos Web Panel, I am using this to host several different domains.
I want to enable AWStats for the domains, I have managed to install AWStats, I've added awstats.[domain].conf files for all the domains and I've setup cron jobs to process the logs.
I am now trying to allow each domain to see only their own data, I tried to add the awstats.pl file to their html folder:
/home/[user]/public_html/stats/awstats.pl
But calling this via http://[domain]/stats/awstats.pl gives me a 404 error.
I've also tried the following locations, all of which give the same 404 error:
/home/[user]/public_html/cgi-bin/awstats.pl
/home/[user]/public_html/stats/cgi-bin/awstats.pl
/home/[user]/public_html/awstats.pl
an example of one of my vhosts files is below:
<VirtualHost [localserverip]:80>
ServerName [domain]
ServerAlias www.[domain]
ServerAdmin webmaster#[domain]
DocumentRoot /home/[user]/public_html
UseCanonicalName Off
ScriptAlias /cgi-bin/ /home/[user]/public_html/cgi-bin/
CustomLog /usr/local/apache/domlogs/[domain].bytes bytes
CustomLog /usr/local/apache/domlogs/[domain].log combined
ErrorLog /usr/local/apache/domlogs/[domain].error.log
# Custom settings are loaded below this line (if any exist)
# IncludeOptional "/usr/local/apache/conf/userdata/[user]/[domain]/*.conf"
<IfModule mod_setenvif.c>
SetEnvIf X-Forwarded-Proto "^https$" HTTPS=on
</IfModule>
<IfModule mod_userdir.c>
UserDir disabled
UserDir enabled [user]
</IfModule>
<IfModule mod_suexec.c>
SuexecUserGroup [user] [user]
</IfModule>
<IfModule mod_suphp.c>
suPHP_UserGroup [user] [user]
suPHP_ConfigPath /home/[user]
</IfModule>
<IfModule mod_ruid2.c>
RMode config
RUidGid [user] [user]
</IfModule>
<IfModule itk.c>
AssignUserID [user] [user]
</IfModule>
<Directory "/home/[user]/public_html">
Options -Indexes -FollowSymLinks
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
</VirtualHost>
I'm sure there's a misconfiguration with the cgi-bin somewhere but I'm not really familiar with how this works, can anyone see why I can't load the awstats file?
Just don't use perl at all, you can get ALL of the exact same functionality with Node.js with absolutely NO setbacks at all.
You're welcome.
So I have two web sites hosted on the same server and same IP address. Ok no biggie. I setup my httpd.conf file in a way I believe is correct. The first site, cascocc.com works no problem. The second site coloradospringshomebuilders.com is the problem. It redirects to http://coloradospringshomebuilders.com/cgi-sys/defaultwebpage.cgi and the www alias does not work. Below is what I think are the relevant parts for my config file with the rest in a paste bin below. I have also included the .htaccess files below as well too. Any ideas?
I am getting a 403 forbidden error any time i try to access anything in the document root. How do I correct this
http.conf file can be found here
.htaccess file for coloradospringshomebuilders.com
.htaccess file for cascocc.com
<VirtualHost 216.172.182.170:80>
ServerName 216.172.182.170
DocumentRoot /usr/local/apache/htdocs
ServerAdmin root#cas.cascocc.com
<IfModule mod_suphp.c>
suPHP_UserGroup nobody nobody
</IfModule>
</VirtualHost>
# Default vhost for unbound IPs
<VirtualHost *>
ServerName cas.cascocc.com
DocumentRoot /usr/local/apache/htdocs
ServerAdmin root#cas.cascocc.com
<IfModule mod_suphp.c>
suPHP_UserGroup nobody nobody
</IfModule>
</VirtualHost><VirtualHost 216.172.182.170:80>
ServerName cascocc.com
ServerAlias www.cascocc.com
DocumentRoot /home/cascocc/public_html
ServerAdmin xxx#cascocc.com
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/cascocc.com combined
CustomLog /usr/local/apache/domlogs/cascocc.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
<IfModule itk.c>
# For more information on MPM ITK, please read:
# http://mpm-itk.sesse.net/
AssignUserID cascocc cascocc
</IfModule>
ScriptAlias /cgi-bin/ /home/cascocc/public_html/cgi-bin/
# To customize this VirtualHost use an include file at the following location
# Include "/usr/local/apache/conf/userdata/std/2_2/cascocc/cascocc.com/*.conf"
</VirtualHost>
# DO NOT EDIT. AUTOMATICALLY GENERATED. IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.
<VirtualHost 216.172.182.170:80>
ServerName coloradospringshomebuilders.com
ServerAlias www.coloradospringshomebuilders.com
DocumentRoot /home/cascohomes/public_html
ServerAdmin xxx#coloradospringshomebuilders.com
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/coloradospringshomebuilders.com combined
CustomLog /usr/local/apache/domlogs/coloradospringshomebuilders.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
<IfModule itk.c>
# For more information on MPM ITK, please read:
# http://mpm-itk.sesse.net/
AssignUserID cascohomes cascohomes
</IfModule>
ScriptAlias /cgi-bin/ /home/cascohomes/public_html/cgi-bin/
# To customize this VirtualHost use an include file at the following location
# Include "/usr/local/apache/conf/userdata/std/2_2/cascohomes/coloradospringshomebuilders.com/*.conf"
</VirtualHost>
Automatically zpanel showing This domains disk limit has been exceeded! for all the websites hosted in VPS with ZPanel
This domains disk limit has been exceeded!
I don't know why this problem occurs but the solutions what I got
Edited /etc/zpanel/configs/apache/httpd-vhosts.conf
Problem Caused Virtual Host Code
# DOMAIN: domain.in
# THIS DOMAIN HAS BEEN DISABLED FOR QUOTA OVERAGE
<virtualhost *:80>
ServerName domain.in
ServerAlias domain.in www.domain.in
ServerAdmin admin#domain.in
DocumentRoot "/etc/zpanel/panel/etc/static/diskexceeded"
<Directory />
Options FollowSymLinks Indexes
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
AddType application/x-httpd-php .php3 .php
DirectoryIndex index.html index.htm index.php index.asp index.aspx index.jsp index.jspa index.shtml index.shtm
</virtualhost>
# END DOMAIN: domain.in
################################################################
Replaced with
################################################################
# DOMAIN: domain.in
<virtualhost *:80>
ServerName domain.in
ServerAlias domain.in www.domain.in
ServerAdmin zadmin#localhost
DocumentRoot "/var/zpanel/hostdata/zadmin/public_html/domain_in"
php_admin_value open_basedir "/var/zpanel/hostdata/zadmin/public_html/domain_in:/var/zpanel/temp/"
php_admin_value suhosin.executor.func.blacklist "passthru, show_source, shell_exec, system, pcntl_exec, popen, pclose, proc_open, proc_nice, proc_terminate, proc_get_status, proc_close, leak, apache_child_terminate, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, escapeshellcmd, escapeshellarg, exec"
ErrorLog "/var/zpanel/logs/domains/zadmin/cessindia.in-error.log"
CustomLog "/var/zpanel/logs/domains/zadmin/cessindia.in-access.log" combined
CustomLog "/var/zpanel/logs/domains/zadmin/cessindia.in-bandwidth.log" common
<Directory />
Options FollowSymLinks Indexes
Require all granted
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
AddType application/x-httpd-php .php3 .php
ScriptAlias /cgi-bin/ "/_cgi-bin/"
<location /cgi-bin>
AddHandler cgi-script .cgi .pl
Options ExecCGI
</location>
ErrorDocument 500 /_errorpages/500.html
ErrorDocument 403 /_errorpages/403.html
ErrorDocument 404 /_errorpages/404.html
ErrorDocument 510 /_errorpages/510.html
DirectoryIndex index.html index.htm index.php index.asp index.aspx index.jsp index.jspa index.shtml index.shtml
</virtualhost>
# END DOMAIN: domain.in
Better Option:
SSH to the server,
type service httpd restart
That's it and problem solved!
Such kind of Problem is happened under the zpanel control panel
first you have to change value of disk quota under the package manager "i.e 0 for unlimited" save it and then reload your apache, see the result
I have my server side at http://example.co.uk, which is accessible in a web browser (or via a normal http request) to http://example.co.uk. However, for my app to be able to access the server side, I'd like it to be able to access exactly the same content on port 5678. So I tried to program this in virtualHosts in my apache config:
<VirtualHost 184.107.24.1:80>
ServerName example.co.uk
ServerAlias www.example.co.uk
DocumentRoot /home/example/public_html
ServerAdmin webmaster#example.co.uk
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/example.co.uk combined
CustomLog /usr/local/apache/domlogs/example.co.uk-bytes_log "%{%s}t %I .\n%{%s}t %O ."
## User example # Needed for Cpanel::ApacheConf
UserDir enabled example
<IfModule mod_suphp.c>
suPHP_UserGroup example example
</IfModule>
<IfModule !mod_disable_suexec.c>
<IfModule !mod_ruid2.c>
SuexecUserGroup example example
</IfModule>
</IfModule>
<IfModule mod_ruid2.c>
RUidGid example example
</IfModule>
ScriptAlias /cgi-bin/ /home/example/public_html/cgi-bin/
# To customize this VirtualHost use an include file at the following location
# Include "/usr/local/apache/conf/userdata/std/2/example/example.co.uk/*.conf"
</VirtualHost>
(that is what I had originally). I have tried adding Listen 5678 and adding 3 lines about a proxy request:
ProxyRequest Off
ProxyPass / http://example.co.uk:5678/
ProxyPassReverse / http://example.co.uk:5678/
Edit your ports.conf file as :
NameVirtualHost *:80
Listen 80
NameVirtualHost *:5678
Listen 5678
Change the VirtualHost definition by
<VirtualHost 184.107.24.1:80 184.107.24.1:5678>