Results 1 to 8 of 8
  1. #1

    How can I http access a server without a domain?

    Hi, I've setup a dedicated server that is currently running with a domain bound to it. However this time I want to setup a centos 5.1 + latest apache 2 + bind 9 server that can only be connected to by IP address and doesn't have a domain name. So what do I need to modify in the below files to do so:

    First of all will I even need bind at all? I already have it setup and (mis-)configured but I guess if I don't need it I can just take if off of autostart and stop the process "named".

    Named.conf
    Code:
    options {
    pid-file "/var/named/chroot/var/run/named/named.pid";
    directory "/var/named/chroot/var/named";
    query-source address * port 53;
    allow-query { any; };
    allow-transfer { };
    recursion no;
    notify no;
    version "unknown";
    };
    
    logging {
    category default { null; };
    };
    
    zone "server.domain.com" { type master; file "server.domain.com.db"; };
    I don't even want the zone have domain.com in its name but that's just there so I could show you how I'd include server.domain.com.db.

    server.domain.com.db
    Code:
    $TTL 14400
    @       IN      SOA     ns1.domain.com.      root.server.domain.com. (
                                                    2007052503
                                                    14400
                                                    3600
                                                    1209600
                                                    86400 )
    
    server.domain.com.    14400    IN    NS    ns1.domain.com.
    server.domain.com.    14400    IN    NS    ns2.domain.com.
    
    localhost    14400    IN    A    127.0.0.1
    www    14400    IN    A    78.129.174.164
    I'm not sure what to do about those references to domain.com here, they shouldn't be needed but without them I don't know what to put here. ^^
    Obviously I can't use those nameservers...

    resolv.conf
    Code:
    nameserver 127.0.0.1
    nameserver 78.129.143.155
    nameserver 87.117.198.200
    nameserver 87.117.196.200
    The only thing missing from this file is "search domain.com" at the top, is that needed even though I won't really have any domains used by this server?


    /etc/hosts:
    Code:
    # Do not remove the following line, or various programs
    # that require network functionality will fail.
    78.129.143.155        server.domain.com
    127.0.0.1        domain.com domain localhost.localdomain localhost
    ::1        localhost6.localdomain6 localhost6
    I never did these:
    Code:
    hostname server.domain.com
    * Change /etc/sysconfig/network file's HOSTNAME to server.domain.com
    I didn't do them because I don't know what to use as a hostname when I don't have a domain.

  2. #2
    Join Date
    May 2007
    Location
    Chicago
    Posts
    322
    If you just want to have Apache serving pages off of the IP address of the server, you don't need to involve Bind at all (really, even if you wanted to use a domain name you don't necessarily need Bind either - you can use your hosting providers DNS services or a third party such as DynDNS).

    For most distributions, Apache is installed to automatically listen to port 80 on the server's IP address. This is easy to check - just point your browser at your IP address. If you don't get a default page back, check the httpd.conf - it should be easy to correct.

  3. #3
    Okay, bind removed but it gives this error message when starting apache:

    [Mon Mar 10 14:28:52 2008] [warn] module php5_module is already loaded, skipping
    [Mon Mar 10 14:28:52 2008] [error] (EAI 2)Name or service not known: Failed to resolve server name for 78.129.174.164 (check DNS) -- or specify an explicit ServerName

    In addition, when I try to access a test file on my server, it says Access Forbidden 403, even though the httpd.conf says to allow it.

  4. #4
    Hey..

    You don't really need the concept of bind or named if you don't have domain name. I hope your IP is dedicated and if you access the IP it will reach the servers apache conf and there it searches for document root and it displays the page.

  5. #5
    Yes, the IP is dedicated. If I go to my server's IP, it will just say access forbidden.

    So now I still need to know how to change the /etc/hosts file and if I should do anything about these:

    hostname server.domain.com
    * Change /etc/sysconfig/network file's HOSTNAME to server.domain.com

  6. #6
    I changed etc/hosts to the following:

    # Do not remove the following line, or various programs
    # that require network functionality will fail.
    78.129.174.164 IS-3995
    127.0.0.1 IS-3995 localhost.localdomain localhost
    ::1 localhost6.localdomain6 localhost6

    And now apache doesn't display that error anymore. However access is still forbidden. Below is my httpd.conf without comments.

    Code:
    ServerRoot "/usr/local/apache2"
    
    Listen 80
    
    LoadModule php5_module modules/libphp5.so
    LoadModule flvx_module modules/mod_flvx.so
    
    <IfModule !mpm_netware_module>
    User daemon
    Group daemon
    </IfModule>
    
    ServerAdmin [email protected] # NOT REALLY
    
    ServerName 78.129.174.164:80
    
    DocumentRoot "/home/freesexd/www"
    
    <Directory />
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
    </Directory>
    
    <Directory "/home/freesexd/www">
        Options Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    
    </Directory>
    
    <IfModule dir_module>
        DirectoryIndex index.html index.php
    </IfModule>
    
    <FilesMatch "^\.ht">
        Order allow,deny
        Deny from all
        Satisfy All
    </FilesMatch>
    
    ErrorLog logs/error_log
    
    LogLevel warn
    
    <IfModule log_config_module>
        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
        LogFormat "%h %l %u %t \"%r\" %>s %b" common
    
        <IfModule logio_module>
          # You need to enable mod_logio.c to use %I and %O
          LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
        </IfModule>
    
        CustomLog logs/access_log combined
    </IfModule>
    
    <IfModule cgid_module>
    </IfModule>
    
    
    DefaultType text/plain
    
    <IfModule mime_module>
        TypesConfig conf/mime.types
    
        AddType application/x-compress .Z
        AddType application/x-gzip .gz .tgz
    
        AddType application/x-httpd-php .php
        
        AddHandler flv-stream .flv
    
    </IfModule>
    
    Include conf/extra/httpd-vhosts.conf
    
    
    <IfModule ssl_module>
    SSLRandomSeed startup builtin
    SSLRandomSeed connect builtin
    </IfModule>
    Below is conf/extra/httpd-vhosts.conf
    Code:
    NameVirtualHost 78.129.174.164:80
    
    <VirtualHost 78.129.174.164:80>
        DocumentRoot "/home/freesexd/www"
    
        UseCanonicalName Off
    
        CustomLog /var/log/httpd/baa.com.bytes bytes
        CustomLog /var/log/httpd/baa.com.log combined
        ErrorLog /var/log/httpd/baa.com.error.log
    
        <Directory /home/freesexd/www>
        ErrorDocument 404 /404.html
        ErrorDocument 401 /401.html
        Options -Indexes FollowSymLinks
        php_admin_value sendmail_path '/usr/sbin/sendmail -t -i'
        </Directory>
    </VirtualHost>

  7. #7
    Still not resolved, I get these kind of errors in my error log:

    [Mon Mar 10 16:33:41 2008] [crit] [client 91.153.186.150] (13)Permission denied: /home/freesexd/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

    I even tried putting an empty .htaccess file there and to /home/freesexd/www but neither helped and .htaccess file shouldn't need to exist anyway, right?

  8. #8
    DOH, finally resolved it. I just had 700 permissions on the /home/freesexd folder.
    Thanks guys for the help anyway.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •