I hosted a website using php-fpm and nginx on Termux and everytime I type the url localhost/sth and it redirects to localhost:8443/sth ,I don't want to see the port 8443, how to solve it?
Type url localhost/something and it redirects to localhost:8443/something
You should investigate your nginx.conf file, it probably has some misconfiguration:
Open the nginx configuration file located at /etc/nginx/nginx.conf
Locate the server block that contains the localhost:8443 server name, and change it to localhost
In the same server block, locate the listen directive and change the port number from 8443 to 80 (the default port for HTTP)
Save the changes and restart the nginx service using the command "service nginx restart"
Open your browser and try accessing the website using the localhost/sth URL. It should no longer redirect to localhost:8443/sth.
Related
I am trying to setup LEMP (Linux, Nginx, MySQL, PHP) stack on my PC to use with Wordpress.
I follow the instructions on this website. I see that the folder of wordpress in www folder was successfully extracted.
I can also verify that Nginx is running. However, I don't know how to get the wordpress index.php page on the browser.
On windows, I simply go to the browser and type localhost/webprojectfoldername or 127.0.0.1/webprojectfoldername
However, when I try to access the index.php of wordpress via localhost, I get the Apache page.
I would like to use Nginx as server but not Apache. I guess at this point, I don't know what servername or ipaddress to put on the browser to get to Nginx's page or Wordpress's index.php
I don't know how to identify the servername that was setup. On Windows, I simply use localhost or 127.0.0.1.
Any thoughts on how I identify it on Ubuntu?
I'd appreciate any help.
Thank you.
*** EDIT (Added Screenshot of Nginx configuration) ****
Either:
nginx is listening on a different port
By default, HTTP works over port 80, but when you connect to that port you are reaching Apache.
You need to find the port nginx is listening on (from the article you link to: listen 80 default_server; shows 80 but lets say it was 81) and connect to that instead: http://localhost:81/`
nginx and apache are trying to listen on the same port and apache won
You need to turn off Apache (and possibly restart nginx).
I used to work on localhost before and never had such issue, the issue was with Apache that was not starting so I went to my http.conf file and changed the port 80 to 8080 and from then I have to put the url present in the image. I just want to use the "localhost/projectname" which is not running at the moment.
I'm testing xampp setup, and when I enter localhost, the homepage doesn't display. The main port is 80, and SSL port is 443. I've tried removing the index and dashboard files, but that didn't work. PHP scripts are not running correctly.
You need to start the Apache.....
XAMPP has all logs in-built. Go to Apache > Logs > Apache (error.log) and do a quick search. In most of the cases you likely want to change the port Apache listens to.
Go to Apache > Config > Apache (httpd.conf) and find Listen 80. Replace it with any non-blocked port, i.e. Listen 8087. Save the file and start Apache again.
I have a client and I need to execute a curl script on it's server but I get a 404 error.
First I tried the other suggestions I've found on other solutions here (adding headers, cookies...)
After that I asked for a SSH access to be able to check more and that's what I've found:
The only URL that doesn't returns a 404 is the home http://aksentropis.com and it doesn't return the homepage's content it just return
<html><body><h1>It works!</h1></body></html>
So I've decided to investigate where this text could be and I've found it on another completely different directories using grep:
./usr/src/httpd-2.4.23/docs/docroot/index.html:1
./usr/local/apps/apache2/www/htdocs/index.html:1
I've entered those directories and they only contain the index.html file
But, the main folder for public_html is on:
/home/admin/public_html
How can I fix that, or what should I do? I only have a ssh root access.
Update: if I call the url from another server it just works...
Update: I've found the DocumentRoot in the apache was misconfigured.
It was pointing to
DocumentRoot "/usr/local/apps/apache2/www/htdocs"
and I've updated it to
DocumentRoot "/home/admin/www"
Now it loads the php but it doesn't execute it. Why is that?
It looks to me like the vhost for this site isn't configured to accept your requests. This could either mean from your location, or using the port you're using.
It could be a matter of your source location. A Require, Allow from or Deny from directive inside your vhost can manage access control.
Apache Docs: Access Control
Perhaps a proxy (such as a load balancer or firewall) usually intercepts port 443 and 80 traffic and redirects it to other ports, and your vhosts are configured to listen to those other ports. Right now all traffic (from your curl location, most likely localhost) appears to be directed to the default apache site, and paths relative to that index file.
Please check the virtual host configuration for this site. It can usually be found in /etc/apache2/sites-enabled/. If the VirtualHost block for that site contains a colon followed by a number, then that's the port number this block is applied to:
<VirtualHost aksentropis.com:1234>
DocumentRoot "/home/admin/public_html"
</VirtualHost>
In the above example the server would be configured to listen to port 1234, which means there's usually something that's between external traffic and the server. Apache Docs: Binding to Addresses and Ports
I got stuck with this problem
For a temporary solution, I changed the port to 5555 in apache httptd.conf
localhost
shows default index.html content
I integerated php with apache and then started apache by executing httpd.exe
localhost:5555/index.php
says url error How do i achieve this?