Subdomain Problem
Hi
I created the following in apache Code:
<VirtualHost *:8080> Quote:
server { listen 80; server_name subdomain.domain.com; ......... } But when i try to access it is not working. What am i missing / doing wrong? |
at what point do you tell nginx to connect to port 8080? Why are you using port 8080 in the first place? Do you have a Listen statment in apache for it? Is it listening from a network check?
|
Quote:
But this subdomain is not loading. |
Quote:
Since you are running your virtualhost in port 8080.Default apache listen on port 80.Have you made entry in apache httpd.conf to listen to virtualhost 8080 Listen 8080 --HTTPD.CONF <VirtualHost *:8080> .. |
Quote:
|
Quote:
I didn't mean to repeat. I made apache to listen. I guess otherwise, the two main domains won't work. Obviously, for the first time, I spent lot of time to make it work. (This apache + nginx) I got some help here too. Now i am struck in subdomain. Please let me know what kind of information do you need? ** Nginx is handling js,css,images (static files) ** Apache is handling php files. Nginx is listening on port 80 Apache is listening on port 8080 |
so again, where in your nginx config do you reference port 8080? Actually, you need to ignore nginx for now... test using the domain purely with apache.
to avoid DNS mess etc, run: curl -H "Host: subdomain.domain.com" 127.0.0.1:8080 and see what that does. Also check the contents of your access and errror logs, especially error on startup. |
location / {
proxy_pass http://127.0.0.1:8080; } This is found in nginx. This is the output of curl <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href="http://www.subdomain.domain.com/">here</a>.</p> </body></html> |
No idea what's providing that back to you, but clearly there is no coverage for that domain name in your apache config, so either create the www ServerAlias or stop that redirect occurring.
|
I have these lines in domain.com
RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] I guess this one is making the subdomain.domain.com to www.subdomain.domain.com But the document root is "subdomain" which has also one htaccess file there. Why should it take the htaccess from domain.com? |
does /var/www/html/subdomain the .htaccess file?
|
Is virtualhost order in htaccess important?
This is the order in htaccess domain.com subdomain.domain.com domain2.com ---------- Post added 10-09-12 at 03:12 AM ---------- Quote:
RewriteBase /subdomain ErrorDocument 404 /404.php |
if there is no suitable matching virtualhost for the host requested then the first virtualhost in the list is used.
|
<VirtualHost *:8080>
DocumentRoot "/var/www/html/domain" ServerName domain.com <Directory "/var/www/html/domain"> allow from all Options -Indexes </Directory> ServerAlias *.domain.com </VirtualHost> <VirtualHost *:8080> ServerName subdomain.domain.com ServerAlias subdomain.* DocumentRoot /var/www/html/domain/subdomain </VirtualHost> <VirtualHost *:8080> DocumentRoot "/var/www/html/domain2" ServerName domain2.com <Directory "/var/www/html/domain2"> allow from all Options -Indexes </Directory> ServerAlias *.domain2.com </VirtualHost> |
why are you using a virtualhost for a subdomain that's in a directory underneath the main domain?
This looks handy: http://stackoverflow.com/questions/9...older-redirect |
All times are GMT -5. The time now is 10:30 PM. |