phpMyAdmin Shows 404 Not Found
http://ip_host/phpmyadmin
I have a Ubuntu 18.04 server running a LEMP (Linux, Nginx, MySQL and PHP)
I created asp.net application and change config file.
Now phpMyAdmin Shows 404 Not Found
http://ip_host/phpmyadmin
server {
server_name myhost.ru www.myhost.ru;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
listen [::]:443 ssl ipv6only=on;
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/myhost.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/myhost.ru/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server {
if ($host = www.myhost.ru) {
return 301 https://$host$request_uri;
}
if ($host = myhost.ru) {
return 301 https://$host$request_uri;
}
listen 80;
listen [::]:80;
server_name myhost.ru www.myhost.ru;
return 404;
}
When I type myhost/phpmyadmin, it shows a 404 Not Found error. How can I fix this? Did I do something wrong?
Related
I have a WordPress server inside a docker container. WordPress is running with a nginx server inside. When I go through the initial installation phase, css (and other files) worked perfectly. But the when I load the main site, those resources redirected to HTTP://example.com/blogs/... instead of HTTPS.
Here are the URLs from the inspect:
https://example.com/blogs/
http://example.com/blogs/wp-includes/js/wp-emoji-release.min.js?ver=5.1.1
Here are my Nginx configuration from example.com:
location /blogs/ {
proxy_pass HTTP://localhost:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 1800s;
}
I have updated the wp-config.php file with the following information
define('WP_HOME','https://example.com/blogs/');
define('WP_SITEURL','https://example.com/blogs/');
$_SERVER['REQUEST_URI'] = '/blogs' . $_SERVER['REQUEST_URI'];
Please let me know if u need any more information.
--- update #1 ---
Nginx Server block
server {
root /var/www/html;
index index.php index.html index.htm;
server_name example.com; # managed by Certbot
location /blogs/ {
proxy_pass HTTP://localhost:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 1800s;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # :managed by Certbot
if ($scheme != https) {
return 301 https://$host$request_uri;
}
}
server {
if ($host = example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 ;
listen [::]:80 ;
server_name example.com;
return 404; # managed by Certbot
}
Check in the wp_options table if siteurl and home are also set with https.
assuming you have a server block for your domain, make sure you have these lines in your server block to redirect all non-https request to https:
server {
listen 80;
listen 443 ssl http2;
server_name example.com www.example.com;
the rest of your code
if ($scheme != https) {
return 301 https://example.com$request_uri;
the rest of your code
}
I have nodejs and react app in different folders. I need a php folder too but when i create a folder with php files in it. If i go to
https://mywebsite/rcon/index.php
shows 404 for them. Almost searching for a fix for 24 hours but cant fix it. Here my nginx default file.
error_log /var/log/nginx/error_log;
server {
listen 80;
server_name mywebsite;
return 301 https://$host$request_uri;
}
server { listen 443 ssl;
server_name mywebsite;
ssl_certificate /etc/letsencrypt/live/mywebsite/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mywebsite/privkey.pem; # managed by Certbot
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
location / {
root /home/ubuntu/staff/;
try_files $uri /index.html index /rcon/index.php /rcon/ index.htm index.nginx-debian.html;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unixsockets):
fastcgi_pass unix:/var/run/php/php7.2fpm.sock;
# With php-cgi (or other tcp sockets):
# fastcgi_pass127.0.0.1:9000;
}
location /api {
proxy_pass http://myip:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /fivem {
proxy_pass http://myip:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# Increase http2 max sizes
http2_max_field_size 64k;
http2_max_header_size 64k;
}
Hi I have working REST Api with ReactPHP on my local machine
I want to deploy it on a dev server ,
I added a newsubdomain on DO, placed a conf with nginx, setup a ongoing process to php index.php my server root file for ReactPHP app.
Allowed the port 8000.
Now I am unable to access my api routes
My server log says Listening on tls://127.0.0.1:8000 as default echo on $loop->run();
on hitting the route of subdomain it says
<html>
<head>
<title>502 Bad Gateway</title>
</head>
<body bgcolor="white">
<center>
<h1>502 Bad Gateway</h1>
</center>
<hr>
<center>nginx/1.14.0 (Ubuntu)</center>
</body>
</html>
My nginx conf
server {
listen 80;
server_name test.example.com;
root /var/www/api;
index index.php index.html index.htm index.nginx-debian.html;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
# Allow the use of websockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen 443 ssl http2;
#ssl info removed
}
After some error and trials made it working
server {
listen 80;
server_name test.example.com;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
# Allow the use of websockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /favicon.ico { alias /path/to/favicon.ico; }
listen 443 ssl http2;
#ssl info removed
}
Some points
Remove root from server
Remove index {We dont need one because ReactPhp has its own Server}
Match proxy_pass port with your ReactPhp Server port
Its better to provide SSL via proxy with nginx { as ReactPhp Docs}
502 Bad Gateway { It was happening because my server was not running at that moment}
I have setup a PHP application on my VPS server provided by Hostgator. The application also includes a websocket implemention using cboden/ratchet on port 8080. Here is the code for starting websocket server.
require_once __DIR__ . '/vendor/autoload.php';
$server = Ratchet\Server\IoServer::factory(
new Ratchet\Http\HttpServer(
new Ratchet\WebSocket\WsServer(
new ChatSocket()
)
),
8080
);
$server->run();
The websocket connection is working fine when ws protocol, but the wss protocol throws error on client side.
WebSocket connection to 'wss://<domain>:8080' failed: WebSocket opening handshake timed out
The VPS server has Apache and Nginx. And nginx is proxying requests to apache. HTTP, HTTPS and WS are working completely fine, but to use HTTPS on client side, WSS needs to be setup. The primary domain is secured with Lets encrypt SSL certificate.
Here is the nginx config:
server {
listen <server-ip>:443 ssl http2;
server_name <domain-name>;
server_name <domain-name>;
server_name <domain-name>;
ssl_certificate /opt/psa/var/certificates/<file-name>;
ssl_certificate_key /opt/psa/var/certificates/<file-name>;
ssl_client_certificate /opt/psa/var/certificates/<file-name>;
client_max_body_size 128m;
root "/var/www/vhosts/<subdomain-dir>/public";
access_log "/var/www/vhosts/system/<subdomain-dir>/logs/proxy_access_ssl_log";
error_log "/var/www/vhosts/system/<subdomain-dir>/logs/proxy_error_log";
#extension letsencrypt begin
location /.well-known/acme-challenge/ {
root /var/www/vhosts/default/htdocs;
types { }
default_type text/plain;
satisfy any;
auth_basic off;
allow all;
location ~ ^/\.well-known/acme-challenge.*/\. {
deny all;
}
}
#extension letsencrypt end
location / {
proxy_pass https://<server-ip>:7081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}
location /internal-nginx-static-location/ {
alias /var/www/vhosts/<subdomain-dir>/public/;
internal;
}
add_header X-Powered-By PleskLin;
}
server {
listen <server-ip>:80;
server_name <domain-name>;
server_name <domain-name>;
server_name <domain-name>;
client_max_body_size 128m;
return 301 https://$host$request_uri;
}
Can you tell me how to setup WSS ?
I just switched my PHP to run from Apache to FastCGI (via Plesk). Now every file I try to access on my domain that's not a php file (like css, images, html ...) gives a 404.
Any idea of what it could be?
vhost specific config file (/etc/nginx/plesk.conf.d/vhosts/mysite.com.conf):
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.
server {
listen 99.99.99.99:443 ssl;
server_name mysite.com;
server_name www.mysite.com;
server_name ipv4.mysite.com;
ssl_certificate /usr/local/psa/var/certificates/certEbk3rnT;
ssl_certificate_key /usr/local/psa/var/certificates/certEbk3rnT;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
client_max_body_size 128m;
root "/var/www/vhosts/mysite.com/httpdocs";
access_log "/var/www/vhosts/system/mysite.com/logs/proxy_access_ssl_log";
error_log "/var/www/vhosts/system/mysite.com/logs/proxy_error_log";
location / {
proxy_pass https://99.99.99.99:7081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}
location /internal-nginx-static-location/ {
alias /var/www/vhosts/mysite.com/httpdocs/;
add_header X-Powered-By PleskLin;
internal;
}
}
server {
listen 50.23.99.2:80;
server_name mysite.com;
server_name www.mysite.com;
server_name ipv4.mysite.com;
client_max_body_size 128m;
root "/var/www/vhosts/mysite.com/httpdocs";
access_log "/var/www/vhosts/system/mysite.com/logs/proxy_access_log";
error_log "/var/www/vhosts/system/mysite.com/logs/proxy_error_log";
location / {
proxy_pass http://99.99.99.99:7080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}
location /internal-nginx-static-location/ {
alias /var/www/vhosts/mysite.com/httpdocs/;
add_header X-Powered-By PleskLin;
internal;
}
}
Requests of *.php files working because nginx transparent proxing it to apache, which catched by proper apache's vhost.
Statics files get 404 because:
proper nginx's vhost can't be found by nginx and request cathced by default vhost
or
there some another nginx vhost which catch all requests(wildcard subdomain *.mysite.com for example).
No any useful advices here, just revise all your nginx configs.