How to change chef nginx default http port 80?

放肆的年华 提交于 2019-12-06 02:36:36

问题


I tried to install apache on a machine that chef-server was installed. Apache could not start up due to the occupation of port 80 by chef nginx. If I want to let apache use port 80 as default, is it possible to change chef nginx default http port to another one?

I found a solution on the Internet to set virtual host on both apache and nginx, but they need a different FQDN as server name. My machine uses an IP instead of FQDN, so I need to change the default HTTP port for chef nginx.

I tried to add /etc/chef-server/chef-server.rb with the following content:

nginx['non_ssl_port'] = 9898

Then I ran 'chef-server-ctl reconfigure'. It didn't work.

Can anyone help on this? Thanks.

Updated

My information was wrong regarding changing the chef server settings.

The settings should be added into /etc/opscode/chef-server.rb for Chef12. After chef-server-ctl reconfigure, nginx's HTTP port is changed to 9898. Thanks.


回答1:


Here is how to change the port. Edit /etc/opscode/chef-server.rb

nginx['non_ssl_port'] = 10080
nginx['ssl_port'] = 10443
nginx['url'] = "https://<YOUR URL>:10443/"

and adjust your local ~/.chef/knife.rb to read

chef_server_url 'https://<YOUR URL>:10443/organizations/<YOUR ORG>'

But currently there is a bug in Chef that prevents the embedded nginx to run on a non standard port: https://github.com/chef/chef-server/issues/50




回答2:


The settings should be added into /etc/opscode/chef-server.rb for Chef12.

After chef-server-ctl reconfigure, nginx's HTTP port is changed to 9898.



来源:https://stackoverflow.com/questions/29643860/how-to-change-chef-nginx-default-http-port-80

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!