nginx: unknow directive"stub_status"
时间: 2023-09-20 08:13:53 浏览: 40
This error message usually indicates that the "stub_status" module is not installed or not enabled in the nginx configuration. The "stub_status" directive is used to enable the server status page in nginx, which provides real-time information about the server's performance and connections.
To resolve this issue, you can try the following steps:
1. Verify that the "stub_status" module is installed on your server. You can do this by running the following command:
```
nginx -V 2>&1 | grep -o with-http_stub_status_module
```
If the output contains "with-http_stub_status_module", it means that the module is installed.
2. If the module is installed, make sure that it is enabled in the nginx configuration file. You can do this by adding the following line inside the "http" block:
```
stub_status on;
```
3. Save the configuration file and restart nginx to apply the changes:
```
sudo systemctl restart nginx
```
If the "stub_status" module is not installed, you can install it using your system's package manager. For example, on Ubuntu, you can run the following command:
```
sudo apt-get install nginx-module-stub-status
```
Once the module is installed, you can follow the steps above to enable it in the nginx configuration.