GithubHelp home page GithubHelp logo

Launch nginx unit about unit HOT 9 CLOSED

franshesco avatar franshesco commented on September 26, 2024
Launch nginx unit

from unit.

Comments (9)

nshadrin avatar nshadrin commented on September 26, 2024 2

@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

from unit.

VBart avatar VBart commented on September 26, 2024 1

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

from unit.

VBart avatar VBart commented on September 26, 2024 1

@franshesco Now your application should work on port 8300.

from unit.

franshesco avatar franshesco commented on September 26, 2024

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

from unit.

igorsysoev avatar igorsysoev commented on September 26, 2024

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.

from unit.

franshesco avatar franshesco commented on September 26, 2024

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

from unit.

franshesco avatar franshesco commented on September 26, 2024

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.

from unit.

franshesco avatar franshesco commented on September 26, 2024

Hi @VBart ,

thx for the reply. exactly, i understand more the unit's concept.

from unit.

nshadrin avatar nshadrin commented on September 26, 2024

Sounds great. Let's close this issue now.

from unit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.