无法重新启动Nginx Web服务器

时间:2020-01-16 19:46:15

标签: ubuntu nginx server

我有一个DigitalOcean Droplet,将laravel应用程序投入生产后,我尝试了以下命令:

sudo systemctl重新加载nginx

但是我得到这个错误:

Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.

我运行sudo nginx -t看看是否有错误,但是conf和语法还可以,之后我就运行了:

sudo nano /var/log/nginx/error.log

我明白了:

2020/01/16 14:53:53 [notice] 14195#14195: signal process started
2020/01/16 14:53:53 [error] 14195#14195: invalid PID number "" in "/run/nginx.pid"
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:443 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:80 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:443 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:80 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:443 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:80 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:443 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:80 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:443 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:80 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: still could not bind()

不管为什么我不能重新启动Web服务器,我的网站仍然可见,但似乎无法重新启动或重新加载Nginx。

1 个答案:

答案 0 :(得分:1)

似乎是<script src="https://bundle.run/lit-element@2.2.1"></script> <drop-down-menu> <li>Item 1</li> <li>Item 2</li> </drop-down-menu>的问题,由于某种原因它是空的。

第一个检查进程google.charts.load('current', { packages: ['corechart'] }).then(function () { var data = google.visualization.arrayToDataTable([ ['Year', 'Data', 'Id'], ['2004', 400, 'Expenses'], ['2004', 1000, 'Sales'], ['2005', 1170, 'Sales'], ['2005', 460, 'Expenses'], ['2006', 660, 'Sales'], ['2006', 1120, 'Expenses'], ['2007', 1030, 'Sales'], ['2007', 540, 'Expenses'] ]); var options = { title: 'Company Performance', curveType: 'function', legend: { position: 'bottom' } }; // create data view with columns for each id var view = new google.visualization.DataView(data); var aggColumns = []; var viewColumns = [0]; // <-- include x-axis as first column data.getDistinctValues(2).forEach(function (id, index) { // add view column for id viewColumns.push({ calc: function (dt, row) { if (dt.getValue(row, 2) === id) { return dt.getValue(row, 1); } return null; }, label: id, type: 'number' }); // add agg column for id aggColumns.push({ aggregation: google.visualization.data.sum, column: index + 1, label: id, type: 'number' }); }); view.setColumns(viewColumns); // aggregate data view var aggData = google.visualization.data.group( view, [0], aggColumns ); var chart = new google.visualization.LineChart(document.getElementById('curve_chart')); chart.draw(aggData, options); });找到nginx的thre根进程(在我的情况下为<script src="https://www.gstatic.com/charts/loader.js"></script> <div id="curve_chart"></div>

/run/nginx.pid

然后杀死它:

ps -ef | grep nginx
  • 检查是否没有正在运行的nginx进程,是否也将其杀死。

然后重新启动nginx 7388

  • 第二个解决方案可能是将进程的ID号写入root@keybu:/var/www/keybu_production# ps -ef | grep nginx root 2314 9443 0 21:28 pts/0 00:00:00 grep nginx root 7388 1 0 2019 ? 00:00:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; nginx 23709 7388 0 Jan15 ? 00:00:04 nginx: worker process ,但尚未对其进行测试