Unit: Excuse me, what method can I get detailed error information锛孡oading configuration file error: "error": "Invalid method."

Created on 23 Sep 2018  路  4Comments  路  Source: nginx/unit

Excuse me, what do I need to do to get detailed error information?The logs only start information

Operation is as follows:

netstat -tulnp | grep unit

tcp 0 0 127.0.0.1:8224 0.0.0.0:* LISTEN 566/unit: main v1.4

curl -X PUT -d@/etc/unit/start.json '127.0.0.1:8224'

{
"error": "Invalid method."
}

cat /etc/unit/start.json

{
"listeners": {
"*:8300": {
"application": "blogs"
}
},

"applications": {
    "blogs": {
        "type": "php",
        "processes": 2,
        "root": "/usr/local/nginx/php",
        "index": "index.php",

    "user": "php",
    "group": "php",

    "options": {
        "file": "/usr/local/php7/lib/php.ini"
    }
    }
}

}

question

Most helpful comment

You can't use the PUT method with 127.0.0.1:8224, that's why it says "Invalid method". You should PUT your configuration object to 127.0.0.1:8224/config/.

curl -X PUT -d@/etc/unit/start.json '127.0.0.1:8224/config/'

All 4 comments

You can't use the PUT method with 127.0.0.1:8224, that's why it says "Invalid method". You should PUT your configuration object to 127.0.0.1:8224/config/.

curl -X PUT -d@/etc/unit/start.json '127.0.0.1:8224/config/'

Hi!
I can not load the configuration.
netstat -tulnp | grep unit
tcp 0 0 127.0.0.1:8300 0.0.0.0:* LISTEN 29335/unit: main v1

cat /etc/unit/start.json
{
"listeners": {
"*:8300": {
"application": "blogs"
}
},

"applications": {
"blogs": {
"type": "php",
"processes": 2,
"root": "/usr/share/doc/unit-php/examples/phpinfo-app",
"index": "index.php",

"user": "nobody",
"group": "nobody",

}
}

}
curl -X PUT -d@/etc/unit/start.json '127.0.0.1:8300/config/'
{
"error": "Failed to apply new configuration."
}
In unit.log
2019/01/10 17:49:00 [alert] 29335#29335 bind(\"0.0.0.0:8300\") failed (98: Address already in use)
2019/01/10 17:49:00 [alert] 29338#29338 failed to apply new conf

changed the address to "listeners": {
"*:8301": {
"success": "Reconfiguration done."

@maksitop Please make sure that you have only one Unit daemon running.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ElDarco picture ElDarco  路  4Comments

R4z0R7 picture R4z0R7  路  3Comments

elijahsgh picture elijahsgh  路  4Comments

hongzhidao picture hongzhidao  路  3Comments

Izorkin picture Izorkin  路  4Comments