Skip to content

Not creating another domain. #3

Description

@jackkelly-bayliss

Hello,

I am currently having the issue where it will not detect a new domain name. It's only reading the very first line of proxydomains. Any suggestions to resolve this?

if nshield_proxy is 1 and dryrun is 0:
	print "Setting up nShield proxy for domains found in /etc/nshield/proxydomains\n"
        # Generates nginx proxy_pass from /etc/nshield/proxydomains and checks if already present in nginx conf
        with open("/etc/nshield/proxydomains") as f:
                content = f.readlines()
                content1 = content[0].split(' ')
                ip = content1[1].strip('\n')
                domain = content1[0]
                if domain not in os.popen("cat /etc/nginx/sites-enabled/dynamic-vhost.conf").read():
                    print "I Will generate proxy configuration for site "+domain+" on IP: "+ip
                    os.popen("""echo 'server {
        listen 80;

        root /var/www/html;
        index index.html index.htm index.nginx-debian.html;

        server_name """+domain+""";

        location / {
    proxy_pass       http://"""+ip+""";
    proxy_set_header Host      $host;
    proxy_set_header X-Real-IP $remote_addr;
}
}
' >> /etc/nginx/sites-enabled/dynamic-vhost.conf""")
                    os.popen('service nginx restart')
                else:
                    print "Domain already configured"

        print "Now you can test that your site is reachable via nShield proxy by changing the domain DNS or via your PC hosts file or directly DNS A record"

Kind Regards,
Jack K-B

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions