Hello, good project.
I don't understand how to launch nginx unit. Where should I create the control socket file unit.control.sock?
What should i need in order to launch unit?
Which file should contain the application and listener detail information? is it the unit.control.sock file?
thx
@franshesco it depends on how you installed unit.
For precompiled packages, location of the socket is /var/run/control.unit.sock or /run/control.unit.sock
If you compile unit from source, you can specify the location in configure time, using --control parameter.
./configure --help
...
--control=ADDRESS set address of control API socket
default: "unix:control.unit.sock"
Default location is in . - current directory where the daemon is launched from.
You can also redefine the socket location when starting the daemon. See unitd --help
If you ever decide to use an IP and port for control API, you should use additional tools to secure it. See here:
http://unit.nginx.org/docs-integration-with-nginx.html#securing-and-proxying-unit-api
On your other question, after starting the daemon, you can upload configuration from any file through the API. See a few examples here: http://unit.nginx.org/docs-configuration.html
hi @nshadrin,
thank you for your reply but I still have some preoccupations.
it means that after the installation, the control.unit.sock file must be automatically created right? I have two centos7 servers, on the first server, I install unit from package but I don't find the control.unit.sock file and the package is installed.
On the second server, I have php 7 installed. When trying to install unit from packages, it needs php 5 and the installation failed because of conflict with php 7. In the documentation, normally unit is compatible with php7. How can I resolve the problem please? I have the error below
Error: php70u-common conflicts with php-common-5.4.16-42.el7.x86_64
Error: php70u-json conflicts with php-common-5.4.16-42.el7.x86_64
I would like to understand how I can launch for example my php project with unit.
What is the content of the control.unit.sock file? can you please show me an example?
thx
unitd creates control.unit.sock when it runs. On exit the socket is deleted. The only prerequisite is a directory where the socket should be created.
Hi @igorsysoev , thank you. sorry but I was not avalaible
I resolved my issue on the first server with unitd which start correctly. I try it for a test. When I use the command curl -X PUT -d @/var/www/html/myapps.json --unix-socket /var/run/control.unit.sock http://localhost/ I have the message "success": "Reconfiguration done." I understand that the configuration is good but i don't still understand how unit helps me to launch my application.
thx
Hi @franshesco,
In order to launch your application, Unit needs to know its location and type. Here's information about how to configure your application and listening socket for it using Unit API: http://unit.nginx.org/docs-configuration.html
You can also watch a demo video, that shows most of the features and configuration: https://www.youtube.com/watch?v=I4IWEz2lBWU
Hi @VBart ,
thx for your reply. I have configured the apps.json file with the listener and object definition as the documentation shows.
{
"listeners": {
"*:8300": {
"application": "myapps"
}
},
"applications": {
"myapps": {
"type": "php",
"workers": 20,
"root": "/var/www/myapps",
"index": "index.php"
}
}
}
I have run the curl command as shown in my previous post.
curl -X PUT -d @/var/www/myapps/myapps.json --unix-socket /var/run/control.unit.sock http://localhost:8300
{
"success": "Reconfiguration done."
}
But I don't understand how unit helps me to launch the application.
I will watch the demo video.
@franshesco Now your application should work on port 8300.
Hi @VBart ,
thx for the reply. exactly, i understand more the unit's concept.
Sounds great. Let's close this issue now.
Most helpful comment
@franshesco it depends on how you installed unit.
For precompiled packages, location of the socket is
/var/run/control.unit.sockor/run/control.unit.sockIf you compile unit from source, you can specify the location in configure time, using --control parameter.
Default location is in
.- current directory where the daemon is launched from.You can also redefine the socket location when starting the daemon. See
unitd --helpIf you ever decide to use an IP and port for control API, you should use additional tools to secure it. See here:
http://unit.nginx.org/docs-integration-with-nginx.html#securing-and-proxying-unit-api
On your other question, after starting the daemon, you can upload configuration from any file through the API. See a few examples here: http://unit.nginx.org/docs-configuration.html