I would want my website subdomain a.site.com to be accessible via alternate port, lets say a.site.com:8866
How can i enable this? a.site.com will be going to the home page of site.com page by default.
It is in a lamp stack. Possible using htaccess? etc?
Thanks.
You can find the settings for those ports in your httpd.conf file (located at apache/conf/httpd.conf), once you opened that up look for listen 80 and change the 80 to your desired port.
note: do not forget to restart your webserver after these changes to update your config.
Related
I run into a strange problem. I have built a wordpress site in a sub domain with Nginx.
It works for access with port none-80, for example:
http://doc.mydomain.com:8085
Then I change its port configuration to 80, but access fails with:
http://doc.mydomain.com
I check the access log, there is only a 301 redirect.
I thought it might due to php, then I replace the content of index.php, it works!
<?php
phpinfo()
So, why the Nginx directs wordpress, while not redirects common php?
I got the reason. The configuration of Wordpress admin has set the website url is http://doc.mydomain.com:8085. After change it, the issue is fixed.
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 created a website using xampp local host and the database information is stored in htdocs/config.cfg.
If I type in 192.168.0.100/config.cfg the browser display the sql database security information.
Can any one help me how to overcome this issue
and how clients can access my site as domain.com instead of 192.168.0.100 not by editing drivers/etc/hosts file.
Use virtualhosts
https://delanomaloney.com/2013/07/10/how-to-set-up-virtual-hosts-using-xampp/
If you using php, use .php file ext for all files instead blahblah.inc and blahblah.cfg. Right way is: blahblah.cfg.php
If you need .cfg and inc extension, configure vhost or apache httpd.conf:
AddType application/x-httpd-php .inc
AddType application/x-httpd-php .cfg
(you need check your server/hosting and configuring it too if you upload your code)
Create sites with "web" directory, and your document_root using it.
Eg.: www.blabla.tld load c:\xampp\htdocs\mysite\web and you store your config files outside from "web" dir.
You need to set up port forwarding for your computer in your router's configuration to make your web server accessible from outside of your local area network. Here's a little step-by-step tutorial:
Assign a statical IP to your computer. This can be done by editing the /etc/network/interfaces file to convert your DHCP network configuration to a static IP configuration or by editing your router's configuration.
Set up port forwarding in your router's configuration. Forward all incoming TCP connections on port 80 to your computer to port 8080.
Change the listening port of your web server to 8080.
Scheme:
Now, everyone should be able to access your web server using your public IP adress.
The access to your config.cfg can simply be restricted by using .htaccess file or by creating a new virtualhosts. I would recommend the second option because you need to create a new virtualhosts for your domain anyway.
Please note that XAMPP is not designed to be used for a production server!
For performance and security reasons, I do strongly recommend to use Apache or nginx with the current stables of PHP 7.0.x and MySQL.
This question already has answers here:
How do I connect to this localhost from another computer on the same network?
(8 answers)
Accessing localhost (xampp) from another computer over LAN network - how to?
(25 answers)
Closed 4 years ago.
I have installed xampp on localhost,and have installed wordpress on it(using port 8080),and have created a website on it.
I need to see that localhost wordpress site from another computer before loading it to a domain.I tried ngrok,but using that i could only get to the XAMPP welcome page.
How can I reach the wordpress site.
P.S. I access the wordpress site on my pc as localhost:8080/wordpress-trunk
Please help
You can access your local site from local network. To do that you need to assign ip to your local server. You can check these links link1 link2
To actually visit you site from internet you'll need to buy services(ip and domain name ) from your isp. Your isp will have to assign the in the dns server they are using. That is you'll have to make your own web server.
If its just for testing purpose best option is to use free hosts
Take a look on your apache configuration, looks like it allows requests only from localhost. Your config should looks like
<Directory /APP>
Allow from all
</Directory>
while now you have something like
<Directory /APP>
Allow from 127.0.0.0/8
</Directory>
* EDITED *
Accordin description, your task is to access your web site from another local computer, rather then from internet. As I can see, you can access this computer (and you can see XAMPP welcome page), so you don't need to follow Tousif Osman's answer, the problem is in your settings.
You can achieve what you want using your public IP adress, even if it's dynamic. First, you need to config a port forwarding in your router. To do this, enter in your router settings, go to port forwarding and there add the LOCAL IP adress from your XAMPP computer. Make sure to select type TCP and RANGE 80-80, because port 80 it's the default port for apache. Make sure you don't use Skype, which also use port 80.
After you did that, reset your router so the changes apply. Now, go to https-vhost.conf file and add something like this
<VirtualHost *:80>
#ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "path to your wordpress directory"
ServerName your public IP
ServerAlias your public IP
</VirtualHost>
After that, go to hosts windows file (System32/Drivers/etc/) and add your IP twice. So, it should look something like this:
localhost localhost
YOUR PUBLIC IP YOUR PUBLIC IP
Don't forget to replace YOUR PUBLIC IP and path to your wordpress directory. Now, restart your apache service. I recommend you to perform a clean wordpress instalation in your wordpress directory and use YOUR PUBLIC IP for the website URL.
Briefly, this is all about it. I'm here if you have questions or problems!
I use cPanel for hosting my website. I have noticed that if anyone who visits my website happens to be a web developer, he can always reach my cPanel Login page via mydomain.com:2082, mydomain.com/cpanel, etc.. It is better to not let the visitors know what control panel I use. I want to disable these URLs. To myself log in to cpanel, I will use the alternate URL provided by my Web Host which is something like a.myhost.com/cpanel.
As a work around, I also changed the main domain and added my main website as an addon domain. But even that didn't work and addondomain.com:2082 and addondomain.com/cpanel showed up the cpanel login and I was able to login there using cpanel username and password.
Please help me hide these pages from the public world. At least addondomain.com:2082 or addondomain.com/cpanel should throw a 404(preferable) or 403 or anything.
I use cPanel 11/x3.
Even my hosting provider is not able to help me with this. Anybody who know anything about this, or implemented this, please help me.
Thanks in advance....
Changing default cPanel port.
The cPanel port can be changed in /var/cpanel/cpanel.config file.
Just change port=2082 (located in the config file) to anything else.
Then running the following commands for the changes to take effect.
/usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings
/etc/init.d/httpd restart
Changing/removing default cPanel URLs.
For the /whm and /cpanel urls, remove/change these lines or similar matched lines located on the /usr/local/apache/conf/httpd.conf file:
ScriptAliasMatch ^/?cpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi
ScriptAliasMatch ^/?webmail/?$ /usr/local/cpanel/cgi-sys/wredirect.cgi
ScriptAliasMatch ^/?whm/?$ /usr/local/cpanel/cgi-sys/whmredirect.cgi
Then run the following commands for the changes to take effect.
/usr/local/cpanel/bin/apache_conf_distiller --update
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart
Source and more info
From a similar discussion raised on cPanel's Forums - "Changing cPanel URL?" (29 Nov 2010):
There is no way to change the port numbers for cPanel, the WebHost Manager or Webmail. The port numbers are hard-coded into cPanel and there is no configuration option that allows them to be changed.
Even if you edit the httpd.conf file and change the ScriptAlias directives that cause /cpanel, /webmail and /whm to work, they will still be accessible via ports 2082/2083, 2095/2096, and 2086/2087, respectively.
(With application, or package specific questions, your best port of call is initially their own forums/helpdesk rather than a general purpose community like StackOverflow.)
this can be easily done with TCP PORT filtering blocking.
Just filter out in iptables every 2082 (may be even 2083) TCP IN and you will have your cpanel port blocked.
You can reinstate it when needed adding an ALLOW directory to the same ports.
Please tell me if you need further help.
There are times you want to disable automatic to SSL connection while accessing WHM, cPanel, Webmail, so you can access cPanel/WHM via standard ports 2082 and 2086, this is pretty useful if you have SSL issue that's preventing you from loging into your server or cPanel account because it may unable to decrypt your stored password.
Login to WHM >> Tweak Setting >> Uncheck the following options under Redirection
Always redirect users to the ssl/tls ports when visiting /cpanel, /webmail, etc.
Also you have to uncheck the following option under Security in Tweak Settings.
Require SSL for all remote logins to cPanel, WHM and Webmail. This setting is recommended.
If you are unable to login to WHM backend, you can disable those options from the shell. SSH to the server as root.
SSH to your server as root
Open
# nano /var/cpanel/cpanel.config and set the following options to 0 (zero).
alwaysredirecttossl
requiressl
—-
alwaysredirecttossl=0
requiressl=0
—–
Save the file and exit.
Login to WHM as root
Under server configuration,
Click on Tweak settings
Click the Redirections tab
Check off button for Always redirect to SSL
save settings & that will be done
Can't you use cpanel to put a redirect on the /cpanel directory? Not sure how to get around 2082 w/o more privileges. Possibly your htaccess?
But really, chill out on the cpanel. No one cares that you make your life easier by using cpanel. Most people do. The only people who are going to know are, as you say, developers. And guess what, they use CPanel too.
If your hosting provider cannot help you with this, then you're out of luck. Advisable to set a .htaccess rule to redirect /cpanel to the homepage.
For your .htaccess:
Redirect /cpanel /
or if it fails,
Redirect /cpanel http://your-site.com
I guess you are in a shared hosting environment. Your best shot is to use an htaccess file, be careful!
the goal is to redirect any thing like : #http://your-site.tld/cpanel or to a #http://your-site.tld but do not redirect #http://your-provider.tld/cpanle
RedirectMatch 301 ^/cpanel/$ http://your-site.tld/
RewriteEngine On
RewriteCond %{SERVER_PORT} !^2082$
RewriteRule ^(.*)$ http://your-site.tld/folder/$1 [L,R]
As I said, test carefully!
I have the exact opposite problem, I just linked my domain mtkroms.com to my blogger website but whenever I try to access mywebsite.com/cpanel it redirects to my blogger blog with the 404 page not found :( due to this I cannot setup subdirectories