Newsroom Update

Beginning in May, a special Today at Apple series titled “Made for Business” will offer small business owners and entrepreneurs free opportunities to learn how Apple products and services can support their growth and success. Learn more >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Server 5.0.4 Default Ports Changes

Hi,


After an auto-update of Server App to 5.0.4, i noticed all my websites stops working.


I was looking in my vhosts files and noticed that now, server changes the default ports to 34580 and 34543 (SSL) and also noticed that in every website the vhosts files changes their names to something like: 0000_127.0.0.1_34580_domain.com.conf. Opening each file, i also noticed the following:


<VirtualHost 127.0.0.1:34580>

ServerName domain.pt:34580

(...)

So, accessing my domain.com it is redirected to: domain.com:34580 (if this port is open in my vlan). The problem is that changing to my old vhosts files, all websites are redirected to default.

How can i put the server app as it was, working on 80 and 443? How can i make server to auto create vhosts files with correct parameters?

Thanks for your help.

Regards

Mozack

Mac mini, OS X Mountain Lion (10.8.2), OSX Server 2.2

Posted on Sep 21, 2015 4:16 PM

Reply
Question marked as Best reply

Posted on Sep 23, 2015 10:54 AM

Hi,


Server 5 uses a reverse proxy (front end) which stands in front of various http-based network services, which I will refer to as backend services. In this configuration, a single apache config is used to handle all of the incoming requests from other hosts - apache_serviceproxy.conf. Incoming requests are reverse proxied to back end services, based on the request URI and whether a given back end service is enabled or disabled.


To create a custom vhost, click the + button under the websites list in Server.app. Define the vhost the same as in previous releases; using some unique combination of domain name, IP address, and port. When you save the site, a new config file will be written into /Library/Server/Web/Config/apache2/sites. The vhost you just created won't be served by an apache instance that's listening on ports reachable from other hosts, but that's OK because the reverse proxy will be ready to proxy those requests to your new vhost, based on configuration that Server adds to /Library/Server/Web/Config/Proxy/apache_serviceproxy_customsites.conf.


One possible reason that your previously created vhosts aren't working might be that those configs are not meant to be behind a reverse proxy. In theory, custom sites that you had created in previous versions of Server should have been converted at upgrade time, but any hand-written / edited configs might not be handled automatically. In this case, you may need to edit those files to look similar to a custom site created by Server 5, or just re-create them from scratch using the Server UI.


I would not recommend trying to 'undo' the reverse proxy setup in Server 5. Hopefully I've explained how you can still add your own custom sites in a way that integrates with the new Server 5 reverse proxy setup. Also, take extreme caution when editing any files that you didn't create. Doing things in the apache config that aren't supported by the UI often causes issues down the road, because the upgrade / migration scripts can't anticipate all the possibilities of a hand-edited config.


Hope this helps.


Cheers,

-dre

18 replies
Question marked as Best reply

Sep 23, 2015 10:54 AM in response to Mo-zack

Hi,


Server 5 uses a reverse proxy (front end) which stands in front of various http-based network services, which I will refer to as backend services. In this configuration, a single apache config is used to handle all of the incoming requests from other hosts - apache_serviceproxy.conf. Incoming requests are reverse proxied to back end services, based on the request URI and whether a given back end service is enabled or disabled.


To create a custom vhost, click the + button under the websites list in Server.app. Define the vhost the same as in previous releases; using some unique combination of domain name, IP address, and port. When you save the site, a new config file will be written into /Library/Server/Web/Config/apache2/sites. The vhost you just created won't be served by an apache instance that's listening on ports reachable from other hosts, but that's OK because the reverse proxy will be ready to proxy those requests to your new vhost, based on configuration that Server adds to /Library/Server/Web/Config/Proxy/apache_serviceproxy_customsites.conf.


One possible reason that your previously created vhosts aren't working might be that those configs are not meant to be behind a reverse proxy. In theory, custom sites that you had created in previous versions of Server should have been converted at upgrade time, but any hand-written / edited configs might not be handled automatically. In this case, you may need to edit those files to look similar to a custom site created by Server 5, or just re-create them from scratch using the Server UI.


I would not recommend trying to 'undo' the reverse proxy setup in Server 5. Hopefully I've explained how you can still add your own custom sites in a way that integrates with the new Server 5 reverse proxy setup. Also, take extreme caution when editing any files that you didn't create. Doing things in the apache config that aren't supported by the UI often causes issues down the road, because the upgrade / migration scripts can't anticipate all the possibilities of a hand-edited config.


Hope this helps.


Cheers,

-dre

Sep 23, 2015 12:40 AM in response to dreness

Hi , I have similar problems. After upgrading to the 5.0.4 version my all sites are automatically redirected to SSL version of the pages, which doesn't exists and then the system choose any Ssl site he can find. I have deleted the SSL site which system choose instead, but this is still showing.


Please can you help me what should I do?

Im not so familiar with background setting. I used always only the Server.app, so please the me exactly where shovel i look and what i need to change.


Thanks.

Sep 23, 2015 10:06 AM in response to dreness

Would it be possible for someone to produce a cheat sheet on addressing the issues with v5 redirecting SSL sites?


I have read through all the threads I can find on this topic and still cannot find a solution. It seems that many of us rely on the Server app (I know I do) to 'just work' and drilling into the background to get it to work again is maddening and confusing. As far as I am able to tell all the files are as they should be (dreness' explanation above makes perfect sense), but I still cannot get this to work.


My next approach will be to delete the SSL certificate for the site and have it reissued and reinstall it, perhaps that will work?


Any guidance GREATLY appreciated.

😟


Mac mini (Late 2014) / 3 GHz Intel Core i7 / 16GB RAM (colo)

OSX 10.11.1 (El Capitan beta) - [updated to try to fix issue]

Server 5.0.4

Apache 2.2

PHP 5.5.29

Sep 23, 2015 10:44 AM in response to Alfista_SK

Hi,


Alfista_SK, it's not clear that you're having the same problem as the original poster in this thread. Requests to the "Server Website" are automatically redirected to SSL, and this shouldn't be disabled because the 'server website' is the one that hosts various built-in services that *should* use SSL. However it is still possible to use a non-SSL site to serve your own content, but you need to use a different domain name than the server's primary hostname for this to work, so the server can tell the difference between requests to the 'server website' and your custom site.


-dre

Sep 23, 2015 10:54 AM in response to Grady Lucas

Hi Grady,


The two main issues I'm aware of involving redirects in Server 5 are:


Relative redirects

If your site uses relative redirects such as:

RewriteRule ^([^/\.]+)/([^/\.]+)/ /foo/ [R=301,L]


you will need to update the redirect to take into account the server name and protocol - this is because in the reverse proxy config, both the name and protocol change as the request traverses the proxy. An updated version of the above redirect might look like:


RewriteRule ^([^/\.]+)/([^/\.]+)/ %{HTTP:X-FORWARDED-PROTO}://%{SERVER_NAME}/foo/ [R=301,L]



Protocol relative redirects (too many redirects)

Rewrite rules that test the protocol on which the request arrived will have to be updated for Server 5, due again to the new reverse proxy configuration. For example, if your site has configuration like:


RewriteCond %{HTTPS} off

RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=302,L]


That could be updated to check the *forwarded* protocol - something like:


RewriteCond %{HTTP:X-Forwarded-Proto} !=https

RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=302,L]



Cheers,

-dre

Sep 23, 2015 11:03 AM in response to dreness

I have two SSL sites on my server; one is at 'Default' the other is on a separate IP.


The one on the separate IP will not show as ACTIVE; meaning the green button is not lit and it just resolves to 'Default.' Also the MX record for that domain reports 'Users may not be able to access domain from the Internet.'


I have been able to add additional domains to the server successfully, there is just something stuck in the configuration for the one other SSL site that will not update.


I have attempted to delete the domain and SSL entirely and recreate it in Server -- no luck.


This seems similar to what #Mo-Zack originally reported above. Perhaps I am on the wrong track?

Sep 23, 2015 11:09 AM in response to Mo-zack

Hi to all of you...


This problem sounds like a degradation of app. I'm using configuration to proxy server already and now, nothing works.


First my websites are redirected to a specific port. After I'm using proxies to refine (OpenRefine) with subdomain like: refine.domain.com. I'm also using proxies to access my web admin of plex server remotely and both of services uses their own ports (3333 and 32400) with another subdomain.


I'm also using proxies to a NAS server administration cause I can't have port 80 assigned twice. So, this situation broke all my system and I really don't know how to solve...


I really appreciate all your help and if someone can tell me how to downgrade server and how to prevent auto upgrade for one application only...


THanks

Sep 23, 2015 11:39 AM in response to Alfista_SK

Alfista_SK wrote:


Hi , I have similar problems. After upgrading to the 5.0.4 version my all sites are automatically redirected to SSL version of the pages, which doesn't exists and then the system choose any Ssl site he can find. I have deleted the SSL site which system choose instead, but this is still showing.



This is probably a separate question from the base question, and these changes are part of a very large effort to increase the security of the whole Internet. Beyond the servers, updates for OS X and iOS application clients are or will intentionally be seeking TLS connections, in preference to insecure connections. Best to get a certificate. Or if this is a private network and you don't want to spend for the commercial certificate, either create your own certificate authority and generate your own certs (involves learning more about how certs work), or just accept the locally-generated certificate when first connecting to the server.

Sep 23, 2015 7:04 PM in response to Mo-zack

Hi Mo-zack,


If you have a complex reverse proxy configuration, then adapting that configuration to Server 5 will probably take some work. The general tradeoff is: the GUI provides an easy-to-use way to set up basic / commonly used configurations, and you should generally expect that anything configured purely by the GUI should be maintained for you by Server, which means those configurations should be automatically updated to adapt to changes in newer Server versions. On the flip side, doing things with Server that can't be done with the GUI (I'm assuming your configuration falls into this category) requires a deeper understanding of the configuration, and usually requires more work than a pure GUI configuration. Additionally, because those configurations might contain elements not supported by the GUI, there is risk of breakage when a newer version comes along that is substantially different, because the upgrade scripts don't account for those unsupported elements. Sometimes even if everything is done in the GUI, there are bugs that can cause breakage, which is why testing and backups are important.


Getting your configurations to work in Server 5 is probably the same scale of work as it was for Server 4, it's just that now you have an environment based on a different set of assumptions, so the configurations needs to account for those differences. I suspect that your configs can be adapted for Server 5, but whether that's a worthwhile effort for you is something only you can decide. If you do attempt this, I would suggest taking time to learn the ins and outs of the 'webapps' mechanism, as that is probably the best place to define web service configurations that are supported by Apple. If you want to roll back to Server 4, plucking Server.app out of a backup should do the trick, although you may want to get a clean slate by removing Server and moving /Library/Server aside before running Server 4 and re-introducing your custom config and site resources. If you instead choose to use a different server platform, there will be more 'manual labor' involved at every turn, in exchange for a much more explicitly defined environment that changes less frequently than Server changes.


Hope this helps,

-dre

Server 5.0.4 Default Ports Changes

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.