• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

502 Error on Creating Subdomain

S_Webb

New Pleskian
I adapted the example on this page for adding subdomains with this packet:

Code:
<packet version='1.5.2.0'>
<subdomain>
 <add>
   <parent>someurl.com</parent>
   <name>$username</name>
   <property>
      <name>www_root</name>
      <value>/path/to/here/$username</value>
   </property>
   <property>
      <name>ftp_login</name>
      <value>********</value>
   </property>
   <property>
      <name>ftp_password</name>
      <value>********</value>
   </property>
 </add>
</subdomain>
</packet>

When the code runs, the subdomain is created, but it returns with a 502 Bad Gateway (nginx) error. I tried looking through the error logs, but found nothing that seemed to be connected with that.

Do you have any suggestions on what I could do? Any help would be greatly appreciated.

Edit: I just found an interesting error in /var/log/nginx/error.log

Code:
2013/04/24 13:36:43 [error] 12258#0: *417 upstream prematurely closed connection while reading response header from upstream, client: **.**.***.***, server: ****.com, request: "GET /test_subdomain.php HTTP/1.1", upstream: "http://***.***.***.***:7080/test_subdomain.php", host: "*****.com"

2013/04/24 13:36:52 [error] 12258#0: *417 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: **.**.**.***, server: ****.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://***.***.***.***:7080/favicon.ico", host: "****.com"

Though I am not really sure what that means needs to happen...
 
Last edited:
I worked it out on my own, but am posting what worked for me in case anyone with the same problem stumbles on this thread.

I found out that Apache restarts when a subdomain is created. That causes an interruption for nginx. There are two solutions for this.

1) Create the subdomains from another server.
2) Increase the Apache restart interval. You can do that by running this in ssh:
Code:
mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -e "update misc set val = '60' where param = 'restart_apache_interval'"

At least that is my best understanding of what is going on.
 
Back
Top