httpd.conf per domain

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GFED
    Confirmed User
    • May 2002
    • 8121

    #1

    httpd.conf per domain

    if i want to add a line such as "ServerAlias *.example.com" to my httpd.conf, but only to one domain on my server is this possible and where do I create the file?

    for example full path to domain public_html is "/usr/home/***username***/domains/***userdomain***.com/public_html"

    I'm guessing I just create a file named httpd.conf one level up from public_html but it's not working.


    Thanks for any help on this =)
    https://www.flow.page/savethechildren
  • Tempest
    Too lazy to set a custom title
    • May 2004
    • 10217

    #2
    It goes in the VirtualHost part for the specific domain in the config file.. Unless of course you've got some weird setup.

    Comment

    • GFED
      Confirmed User
      • May 2002
      • 8121

      #3
      i'm looking for an option besides editing the MAIN httpd.conf file. i'm sure I had this option on other hosts. just not sure of the file name or location to make appendages.
      https://www.flow.page/savethechildren

      Comment

      • oscer
        Confirmed User
        • Jan 2001
        • 2834

        #4
        well as long as you have the Correct Syntax then you need to add a line in your main httpd.conf that shows it where to look for the virtualhost configs Again In the correct Syntax ... or stuff will break
        XR Networks
        Dedicated | VPS | Shared Hosting
        ICQ 42602565

        Comment

        • Konda
          ...
          • Apr 2003
          • 2280

          #5
          There is only one httpd.conf on the server. You need root access to edit it. In the httpd.cond find the virtualhost entry for that domain and add the line inside the virtualhost part for that domain.

          Comment

          • Tempest
            Too lazy to set a custom title
            • May 2004
            • 10217

            #6
            Originally posted by GFED
            i'm looking for an option besides editing the MAIN httpd.conf file. i'm sure I had this option on other hosts. just not sure of the file name or location to make appendages.
            The option for doing it somewhere else only exits if the main http file includes separate virtual host file(s)...

            Comment

            • raymor
              Confirmed User
              • Oct 2002
              • 3745

              #7
              Originally posted by Tempest
              The option for doing it somewhere else only exits if the main http file includes separate virtual host file(s)...

              Many control panels, such as CPanel and Directadmin, will by default include certain files if they exist. If you're using a control panel, post which one or email us for help.

              However, this very much reminds me of the "how to start the car" instructions I once saw on the back of a visor. If you don't know how to START a car, you shouldn't be driving one. You should get driving lessons or take a taxi. We've seen a lot of "professionals" do a lot of REALLY dumb things with Apache configuration. If you need help with the mechanics of where to put your configuration, you would be wise to have a qualified person review the configuration you plan to use.
              For historical display only. This information is not current:
              support@bettercgi.com ICQ 7208627
              Strongbox - The next generation in site security
              Throttlebox - The next generation in bandwidth control
              Clonebox - Backup and disaster recovery on steroids

              Comment

              • Kiopa_Matt
                Confirmed User
                • Oct 2007
                • 1448

                #8
                Two options:

                1.) Look into and teach yourself mod_rewrite. You can have requests routed based on server name.

                2.) Add one line to your httpd.conf file, such as "Include /path/to/my/httpd_conf/*". Then all files within that directory will be automatically included when Apache restarts, allowing you to create one httpd.conf per-domain, or whatever you wanted.
                xMarkPro -- Ultimate Blog Network Management
                Streamline your marketing operations. Centralize management of domains, pages, Wordpress blogs, sponsors, link codes, media items, sales and traffic statistics, plus more!

                Comment

                • GFED
                  Confirmed User
                  • May 2002
                  • 8121

                  #9
                  Originally posted by Tempest
                  The option for doing it somewhere else only exits if the main http file includes separate virtual host file(s)...
                  got it, thanks!
                  https://www.flow.page/savethechildren

                  Comment

                  • Diomed
                    Converting like it's 1999
                    • Jan 2009
                    • 6167

                    #10
                    Christ,

                    I hope all of you are making a ton of money.

                    Thank god I decided to take the easy route into being a webmaster.

                    Site concepts - pitch point - landing page - traffic buys - pay day.

                    Whew.
                    10 years of experience in:

                    CHAT SALES - PAID TRAFFIC - CONVERSION - CREATIVES - CONSULTATION

                    Comment

                    • fris
                      Too lazy to set a custom title
                      • Aug 2002
                      • 55689

                      #11
                      Originally posted by GFED
                      if i want to add a line such as "ServerAlias *.example.com" to my httpd.conf, but only to one domain on my server is this possible and where do I create the file?

                      for example full path to domain public_html is "/usr/home/***username***/domains/***userdomain***.com/public_html"

                      I'm guessing I just create a file named httpd.conf one level up from public_html but it's not working.


                      Thanks for any help on this =)
                      maybe try mod_vhost_alias

                      something like this

                      Code:
                      <VirtualHost *:80>
                        ServerName          example.com
                      
                        DocumentRoot        /home/user/domains
                        VirtualDocumentRoot /home/user/domains/%0/public_html
                      </VirtualHost>
                      
                      <VirtualHost *:80>
                        ServerName          www
                        ServerAlias         www.*
                      
                        DocumentRoot        /home/user/domains
                        VirtualDocumentRoot /home/user/domains/%2+/public_html
                      </VirtualHost>
                      example /home/user/domains/gfy.com/public_html will work by creating a gfy.com/ dir with a subdir of public_html

                      this will create them on the fly.
                      Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                      Comment

                      • chaze
                        Confirmed User
                        • Aug 2002
                        • 9774

                        #12
                        You normaly would do the in the vhost part of the main file. But to avoid that you might be able to add something to the .htaccess I would go from there.
                        Like the desert needs the rain
                        We do fully manged WordPress, VPS, and Servers. Adult Host Pro https://adulthostpro.com/ Since 2001

                        Comment

                        • Barry-xlovecam
                          It's 42
                          • Jun 2010
                          • 18083

                          #13
                          *example.com is a wildcard DNS record.

                          a.example.com, b.example.com, c.example.com, d.example.com, etc ... will all resolve to example.com with the same content if that is what you want to accomplish.

                          http://en.wikipedia.org/wiki/Wildcard_DNS_record

                          Comment

                          Working...