make_vhosts mods.

Discussion in 'General' started by djtremors, Jul 12, 2006.

  1. djtremors

    djtremors New Member

    Hi again,

    I'm editing my /root/ispconfig/scripts/lib/config.lib.php in the make_vhosts() section to do some custom mods and wanted to know exactly where does the IPs get written to in the VirtualHost itself. I found the 'sharedip' section but can't find the writing of the real isp site domain config.? I want to override the IP addresses being written.

    PHP:
    <VirtualHost x.x.x.x:80>
    ServerName www.yourdomainname.com.au:80
    ServerAdmin webmaster
    @yourdomainanme.com.au
    Oh, another thing I wanted to know in general is what do admins do about quotas when file uploads and such are owned by apache and not the user. Quotas aren't in effect and using suphp is a b%#%*, couldn't figure out the /usr/bin/php4-cgi where it didn't exist. And don't want CGI anyway..

    the only thing I can think of if you want to stick with mod_php is to change the ownership of the files over night for all accounts.
     
    Last edited: Jul 12, 2006
  2. djtremors

    djtremors New Member

    Line 1839.. got it.

    foreach($ips as $ip){
    $web = $mod->db->queryOneRecord("SELECT * FROM isp_nodes,isp_isp_web WHERE isp_isp_web.server_id = '$server_id' AND isp_nodes.doc_id = isp_isp_web.doc_id AND isp_nodes.doctype_id = '".$this->web_doctype_id."' AND isp_nodes.status = '1' AND isp_isp_web.web_ip = '*' AND isp_isp_web.web_anonftp = '1'");

    This will now do away with my NAT problems and DNS.
     
  3. fobicodam

    fobicodam New Member

    aint easier to add the ip to the ispconfig control panel and use this ip when you create the website?

    second, if your server has a internal ip and you setup a domain with a external ip, you may generate routing problems with your firewall..
     
  4. djtremors

    djtremors New Member

    routing problems? lol

    No, it's a NAT.

    If I put 192.168.1.10 as an IP for the server there is 2 things that happen.

    1. You get a VirtualHost of 192.168.1.10:80 (which is fine, BUT...)
    2. You also end up with an Internal IP in the DNS.

    This means you have to go an edit the DNS for every time you create a new site. You could also put 2 IPs and select the other but this will just confuse people using it.

    My solution is to hardcode * as the VirtualHost as I only have 1 IP anyway and setup ISPC with my external IP.
    This then solves my problem and there's no confused on what IP to use as there's only 1 IP is the combo list and it's external which doesn't tell the client/reseller what my internal network workings are.

    make sense?
     
  5. fobicodam

    fobicodam New Member

    Yes, its ok, but, if you server wants to connect with you internal sites will be impossible.

    The solution is seting up both ips on your server, ISPconfig must use the external only (delete the internal if you want) that way you dont need to change any php file and your server will see the external address.

    Dont care about NAT with this solution, as NAT will never see the external address configured on you internal linux.
     
  6. djtremors

    djtremors New Member

    PHP:
    if you server wants to connect with you internal sites will be impossible
    Not true. It will browse itself by going to the firewall (default gateway to reach it's exterternal IP) and bouncing back via NAT just like having your website on the same as your LAN, the firewall takes care of it.

    Worst case scenario is only that internal IPs are logged as the firewalls IP when looking at the web stats (like I give a hoot anyway). All external browsing logs are fine.

    believe me, it works well for me.
     
  7. fobicodam

    fobicodam New Member

    Your router lets you, from inside, ping the outside ip and reach your internal server??? what kind of router do you have?
     
  8. falko

    falko Super Moderator Howtoforge Staff

    This is true if you use Default DNS and Default MX and are in a local network (for servers with a public IP address this is no problem).
    If you change the IP addresses in make_vhost(), make sure you use only IP addresses that are on the server (i.e., that you see when you run
    Code:
    ifconfig
    ). Otherwise Apache will not serve them.
     
  9. djtremors

    djtremors New Member

    PHP:
    Your router lets youfrom insideping the outside ip and reach your internal server??? what kind of router do you have?
    Not really, a ping is not port forwarded to the webserver and only port 80TCP and 53UDP and 53TCP (only secondary NS has access to this, stops hijacks) are portforwarded. I use ipcop as it makes it easier for these other n00bs at work handle firewall rules *sigh*.

    My server works perfect now, I have 1 IP set in ISPconfig as it's the external IP but websites are listening on any IP (only has internal IP and uses *:80) and when a new site is created it puts the external on the DNS/MX and VirtualHosts are setup with * instead of external address (due to NATs). Works like a charm.

    @falko: Yeah there were 3 places I needed to change
    1: NameVirtualHosts *:80
    2: ShareHost IP *:80
    3: VirtualHost itself for each site through the foreach() loop.


    Only thing now is to get my FTP user working without having an email address. damn thing always enforced having an email even when External MX is setup.. grrrr.. HAaaaack again..
     
  10. falko

    falko Super Moderator Howtoforge Staff

    When you use "External Mailserver", you still have to specify an email address in the interface, but it doesn't get written to the Postfix configuration. :)
    Ino one of the next release you will have a checkbox that lets you choose if you need an email address for a user.
     
  11. djtremors

    djtremors New Member

    Yes, well I noticed that there was suppose to be code which checks if externalMailserver was set or not and it'll do the postfix stuff but apparently there's no code for it so I hacked about it myself and now i can create ftp users without mail accounts and users with mail accounts.

    Took me a while to figure it out due to german comments (hint hint)... ;)
     
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    The code is in the dev branch.
     

Share This Page