ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Second Hostname Not Loading on Apache Virtual Host

    Scheduled Pinned Locked Moved IT Discussion
    web serverubuntuwordpress
    28 Posts 3 Posters 6.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • thanksajdotcomT
      thanksajdotcom @scottalanmiller
      last edited by

      @scottalanmiller said:

      Do you have the right details in the VirtualHost config?

      Yes. Give me a sec and I'll post the two configs.

      1 Reply Last reply Reply Quote 0
      • thanksajdotcomT
        thanksajdotcom
        last edited by thanksajdotcom

        Site 1:

        *<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

            ServerAdmin webmaster@localhost
            ServerName thanksaj.com
            ServerAlias www.thanksaj.com
            DocumentRoot /var/www/thanksaj.com
        
            # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
            # error, crit, alert, emerg.
            # It is also possible to configure the loglevel for particular
            # modules, e.g.
            #LogLevel info ssl:warn
        
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
        
            # For most configuration files from conf-available/, which are
            # enabled or disabled at a global level, it is possible to
            # include a line for only one particular virtual host. For example the
            # following line enables the CGI configuration for this host only
            # after it has been globally disabled with "a2disconf".
            #Include conf-available/serve-cgi-bin.conf
        

        </VirtualHost>*

        1 Reply Last reply Reply Quote 0
        • thanksajdotcomT
          thanksajdotcom
          last edited by

          Site 1 works btw.

          1 Reply Last reply Reply Quote 0
          • thanksajdotcomT
            thanksajdotcom
            last edited by

            Site 2:

            *<VirtualHost *:80>
            # The ServerName directive sets the request scheme, hostname and port that
            # the server uses to identify itself. This is used when creating
            # redirection URLs. In the context of virtual hosts, the ServerName
            # specifies what hostname must appear in the request's Host: header to
            # match this virtual host. For the default virtual host (this file) this
            # value is not decisive as it is used as a last resort host regardless.
            # However, you must set it for any further virtual host explicitly.
            #ServerName www.example.com

                ServerAdmin builtbyart@gmail.com
                DocumentRoot /var/www/builtbyart.com
                ServerName builtbyart.com
                ServerAlias www.builtbyart.com
            
                # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
                # error, crit, alert, emerg.
                # It is also possible to configure the loglevel for particular
                # modules, e.g.
                #LogLevel info ssl:warn
            
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined
            
                # For most configuration files from conf-available/, which are
                # enabled or disabled at a global level, it is possible to
                # include a line for only one particular virtual host. For example the
                # following line enables the CGI configuration for this host only
                # after it has been globally disabled with "a2disconf".
                #Include conf-available/serve-cgi-bin.conf
            

            </VirtualHost>*

            Site 2 does not work.

            1 Reply Last reply Reply Quote 0
            • JaredBuschJ
              JaredBusch
              last edited by

              If site 1 is also your default document root, that is why it is working, not because the virtual host is correct.

              1 Reply Last reply Reply Quote 0
              • thanksajdotcomT
                thanksajdotcom
                last edited by

                <VirtualHost *:80>

                That is the first line but the doing it in italics screwed it up.

                JaredBuschJ 1 Reply Last reply Reply Quote 0
                • thanksajdotcomT
                  thanksajdotcom
                  last edited by

                  They each have a different document root. Each is in the appropriate website folder in /var/www

                  1 Reply Last reply Reply Quote 0
                  • JaredBuschJ
                    JaredBusch @thanksajdotcom
                    last edited by

                    @ajstringham said:

                    <VirtualHost *:80>

                    That is the first line but the doing it in italics screwed it up.

                    I use notepad++ to tab out an entire section i want to paste here then the nobebb detects it as code.

                    thanksajdotcomT 1 Reply Last reply Reply Quote 0
                    • thanksajdotcomT
                      thanksajdotcom @JaredBusch
                      last edited by

                      @JaredBusch said:

                      @ajstringham said:

                      <VirtualHost *:80>

                      That is the first line but the doing it in italics screwed it up.

                      I use notepad++ to tab out an entire section i want to paste here then the nobebb detects it as code.

                      Yeah, I didn't realize it did that.

                      JaredBuschJ 1 Reply Last reply Reply Quote 0
                      • JaredBuschJ
                        JaredBusch @thanksajdotcom
                        last edited by

                        @ajstringham my CentOS6.5 webserver has apache 2.2 ithink and when i setup this Centos7 server it is 2.4. I had to add the directory element to my existing virtual host info that i copy/pasted over to the new server.

                        		<Directory />
                        			Require all granted
                        			Options Indexes FollowSymLinks Includes ExecCGI
                        			AllowOverride All
                        			Order allow,deny
                        			Allow from all
                        		</Directory>
                        
                        thanksajdotcomT 1 Reply Last reply Reply Quote 0
                        • thanksajdotcomT
                          thanksajdotcom @JaredBusch
                          last edited by

                          @JaredBusch said:

                          @ajstringham my CentOS6.5 webserver has apache 2.2 ithink and when i setup this Centos7 server it is 2.4. I had to add the directory element to my existing virtual host info that i copy/pasted over to the new server.

                            	<Directory />
                            		Require all granted
                            		Options Indexes FollowSymLinks Includes ExecCGI
                            		AllowOverride All
                            		Order allow,deny
                            		Allow from all
                            	</Directory>
                          

                          It's all one server. Those settings are in a different Apache file than the virtual-hosts file.

                          1 Reply Last reply Reply Quote 0
                          • thanksajdotcomT
                            thanksajdotcom
                            last edited by

                            I have 3 files in my /etc/apache2/sites-enabled folder. 000-default.conf, builtbyart.com.conf, and thanksaj.com.conf. The default one has to be there. However, the actual virtual host is brought online when you run:

                            a2ensite builtbyart.com
                            a2ensite thanskaj.com

                            The site name must correspond to a .conf. So if I'm bringing thanksaj.com online, the file has to be thanksaj.com.conf.

                            1 Reply Last reply Reply Quote 0
                            • thanksajdotcomT
                              thanksajdotcom
                              last edited by

                              What I can't figure out is why ThanksAJ.com DOES work but BuiltByArt.com DOES NOT. They are configured exactly the same.

                              scottalanmillerS 1 Reply Last reply Reply Quote 0
                              • JaredBuschJ
                                JaredBusch
                                last edited by JaredBusch

                                Well I cannot help you as my webserver is a simple standard CentOS box with a clean apache install. All the settings are in /etc/httpd/conf/httpd.conf

                                thanksajdotcomT 1 Reply Last reply Reply Quote 0
                                • thanksajdotcomT
                                  thanksajdotcom @JaredBusch
                                  last edited by

                                  @JaredBusch said:

                                  Well I cannot help you as my webserver is a simple standard CentOS box with a clean apache install. All the settings are in /etc/httpd/conf/httpd.conf

                                  Yeah, the RPM-based system vs a Debian-based system.

                                  JaredBuschJ 1 Reply Last reply Reply Quote 0
                                  • JaredBuschJ
                                    JaredBusch @thanksajdotcom
                                    last edited by

                                    @ajstringham does not explain why apache config files are different. one would think that would work the same because it is apache not the OS.

                                    thanksajdotcomT 1 Reply Last reply Reply Quote 1
                                    • thanksajdotcomT
                                      thanksajdotcom
                                      last edited by

                                      I have even tried redoing Wordpress.

                                      EDIT: I just checked and had forgotten to redo Wordpress after deleting the old files...oops. Let's try that again..

                                      1 Reply Last reply Reply Quote 0
                                      • thanksajdotcomT
                                        thanksajdotcom @JaredBusch
                                        last edited by

                                        @JaredBusch said:

                                        @ajstringham does not explain why apache config files are different. one would think that would work the same because it is apache not the OS.

                                        True.

                                        1 Reply Last reply Reply Quote 0
                                        • scottalanmillerS
                                          scottalanmiller @thanksajdotcom
                                          last edited by

                                          @ajstringham said:

                                          What I can't figure out is why ThanksAJ.com DOES work but BuiltByArt.com DOES NOT. They are configured exactly the same.

                                          One is being picked up as the default fall through and the other is not.

                                          1 Reply Last reply Reply Quote 0
                                          • thanksajdotcomT
                                            thanksajdotcom
                                            last edited by

                                            Hmm....

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post