Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I have a problem where my server running NginX with php-fpm loads blank PHP pages (strangely except for my phpinfo.php https://forum.tuteehub.com/tag/file">file, which loads normally). If I put an index.html page in the same directory and browse to it, it loads. The fact that phpinfo.php (which https://forum.tuteehub.com/tag/calls">calls the phpinfo(); function) loads, confirms that php-fpm works.
I am hoping somebody might have some advice. I apologise in advance for the bulk of info I am about to give, but I would rather give too much information than too little. Here are my configuration https://forum.tuteehub.com/tag/file">files.
/etc/nginx/conf.d/default.conf:
server { listen 80; server_name 45.55.182.120; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; root /usr/share/nginx/html; index index.php index.html index.htm; location / { try_https://forum.tuteehub.com/tag/file">files $uri $uri/ =404; } https://forum.tuteehub.com/tag/error">error_page 404 /404.html; # redirect server https://forum.tuteehub.com/tag/error">error pages to the static page /50x.html # https://forum.tuteehub.com/tag/error">error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php$ { try_https://forum.tuteehub.com/tag/file">files $uri =404; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name; include fastcgi_params; } server { listen 80; server_name 45.55.182.120; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; root /usr/share/nginx/html; index index.php index.html index.htm; location / { try_https://forum.tuteehub.com/tag/file">files $uri $uri/ =404; } https://forum.tuteehub.com/tag/error">error_page 404 /404.html; # redirect server https://forum.tuteehub.com/tag/error">error pages to the static page /50x.html # https://forum.tuteehub.com/tag/error">error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php$ { try_https://forum.tuteehub.com/tag/file">files $uri =404; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name REPLY 0 views 0 likes 0 shares Facebook Twitter Linked In WhatsApp
According to your configuration, you have two server{...} blocks which are exactly the same. So before I start explain what's wrong with your configuration, you need to provide more details. See down below for some troubleshooting hints.
server{...}
For now, I'll post mine here and highlight a few directives that do matter.
directives
My /etx/nginx/conf.d/default.conf looks as follow
/etx/nginx/conf.d/default.conf
server { # Replace this port with the right one for your requirements listen 80; # Multiple hostnames separated by spaces. Replace these as well. server_name mydomain.nl; root /var/www/mydomain.nl/public_html/; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; index index.php index.html; location / { # This is cool because no php is touched for static content. try_files $uri $uri/ /index.php; } location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ { expires max; } location ~* \.php$ { try_files $uri =404 fastcgi_intercept_errors on; fastcgi_index index.php; fastcgi_pass unix:/var/run/php5-fpm.sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; } location ~ /\.(ht|ssh) { deny all; } location /status { include fastcgi_params; fastcgi_pass unix:/var/run/php5-fpm.sock; } }
The following directives are important:
server_name mydmaiin.nl; <-- This is unique for every server block.
server_name mydmaiin.nl;
root /var/www/mydomain.nl/public_html/; <-- This is the root that holds your website / data.
root /var/www/mydomain.nl/public_html/;
The rest is trivial.
So Let's take the /etc/php-fpm.d/www.conf file and examine. You chose to use a file socket
/etc/php-fpm.d/www.conf
listen = /var/run/php-fpm/php-fpm.sock <-- php-fpm will communicate with nginx through this file. So this is my www.conf file unless you missed something. I've filtered out all commented lines. So these are the lines that are uncommented.
listen = /var/run/php-fpm/php-fpm.sock
nginx
www.conf
[www] listen = /var/run/php5-fpm.sock listen.allowed_clients = 127.0.0.1 listen.owner = nginx listen.group = nginx listen.mode = 0666 user = apache group = apache pm = dynamic pm.max_children = 50 pm REPLY 0 views 0 likes 0 shares Facebook Twitter Linked In WhatsApp
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 10 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 9 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.