Resolving 404 Errors on Nginx After an Ubuntu Server Upgrade
One of the most common Web server combinations today features the Nginx Web server software implementation running on Ubuntu Server edition. This system is extremely efficient and easy to keep updated, since both packages continue to receive regular updates. System administrators generally install updates through the apt package manager, because Ubuntu Server has no graphical interface by default.
Ubuntu Server upgrades can sometimes generate unusual errors, and this lack of a graphical user interface can make it difficult for beginners to troubleshoot them. A few simple commands might be all it takes to fix 404 Nginx errors after an Ubuntu upgrade.
Method 1:Fixing Missing Nginx Error Pages
If a site is hosted on AWS, a private server or any other server configuration in a LEMP stack, it might go down randomly after an Ubuntu Server upgrade. Attempt to access the site from a Web browser, perhaps on another machine. 404 エラーが返された場合は、Ubuntu サーバー CLI に移動し、コマンド tail -f を実行して、最新のエラーをすべて表示します。
ログに次のようなエラーが含まれている場合:
Your system is suffering from a missing error page.この行には 40x.html も表示されることがありますが、サイトがダウンしていて代わりに 404 エラーが発生する場合は比較的まれです。 Use the command ls to see if there’s anything there.そうでない場合は、50X エラーに対応するページの HTML コードを作成する必要があります。
Keep in mind that using the default directory structure is often a problem with package managers, which can overwrite whatever gets stored there. You can change the docroot line in the Nginx configuration to prevent this sort of problem if you’re permitted to create a custom directory structure.
Method 2:Making PHP Find the Right Socket
に次のようなエラーが表示される場合もあります。
This means you have PHP7.0 running, but it isn’t running where it should be.バージョン番号は、PHP の構成によって異なる場合があります。デフォルトのインストールは または から実行されますが、このエラーが発生する場合は、そうでない可能性が高くなります。
Run the commands and then find -name ‘php*fpm.sock’ to see if there’s a socket running somewhere on your system.
Assuming you received positive output, then you need to update your Nginx configuration to show the correct place in the socket should be running. Naturally, /directoryPath would be replaced with the correct path.ソケット ファイルを使用している場合は、行 php/php7.0-fpm.sock で設定を更新する必要があります。
Users of the older TCP sockets that don’t use socket files can check if a PHP socket is currently listening to port 9000 by running sudo netstat -tulpn |コマンドラインから grep 9000 を実行します。 If this is the case, then open up your fastcgi_pass in nano, vi or another text editor and change out the unix:… line to instead use 127.0.0.1:9000 to update the socket.
Should none of this work, then make sure that php7.0-fpm or whatever version number you’re using is running with the command sudo systemctl restart php7.0-fpm, followed by repeating the above process.
ほとんどの状況では、 の listen エントリと の値は同じである必要があることに注意してください。 You might try for newer configurations, or 127.0.0.1:9000 for old style ones.
著者について
ケビン・アロウズ
Kevin Arrows は、10 年以上の業界経験を持つ、経験と知識が豊富なテクノロジー スペシャリストです。彼は Microsoft Certified Technology Specialist (MCTS) 認定を取得しており、最新の技術開発について常に最新の情報を入手することに深い情熱を持っています。 Kevin は、ソフトウェア開発、サイバーセキュリティ、クラウド コンピューティングなどの分野での専門知識と専門知識を示し、テクノロジー関連の幅広いトピックについて幅広く執筆しています。テクノロジー分野への彼の貢献は同僚から広く認められ、尊敬されており、複雑な技術概念を明確かつ簡潔に説明する能力が高く評価されています。
-
Linux Wi-Fi をマスターする:ステップバイステップのドライバー トラブルシューティング ガイド
Wi-Fi ドライバーは、コンピューターを Microsoft Windows または別のオペレーティング システムのバージョンで起動するときに正常に動作する場合でも、Linux での構成が難しい場合があります。ワイヤレス ネットワーク アダプターが自動的に接続できない場合や、接続を機能させるためにグラフィカル環境で接続アイコンを複数回クリックする必要がある場合もあります。一般的に、何が起こっているのかというと、システムがドライバーをポーリングしている時間が十分ではないということです。 まず、ハードウェアの最新ドライバーを実行しているかどうかを確認し、それが機能しない場合は、syslog を
-
Ubuntu に qpdfview を簡単にインストールする:ステップバイステップ ガイド
軽量のタブ付き PDF ビューアを探している Ubuntu ユーザーは長い間 qpdfview を利用してきましたが、それをインストールするのは常に困難でした。特別な PPA リポジトリを使用するか、ソース コードを自分でダウンロードして構築する必要がありました。 これらの方法はどちらも多くの人にとって不必要に複雑でしたが、ユーザーは実行する前にプログラムの内部を確認する機会が得られました。 Canonical の公式リポジトリには、Universe リポジトリに qpdfview が含まれるようになりました。 Ubuntu 15.10 以降のすべてのユーザーは、単純な apt-get コ