Access new web site via browser with IP address? [closed] - apache

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Ive set up a new site with WHM but havent got the DNS set up yet. I want to be able to access the site via a browser so I can set up a CMS. Usually, I can just do this by entering the IP address into the browser, but this time I just get a page saying that Apache is working on the server.
Does anyone know a way round this?
Thanks!

The problem is that the request your browser is sending doesn't include the correct Host: in the HTTP header, so the web server replies with the a default catch-all page.
You can either
setup a private (local) authoritative DNS server with a yoursite.com zone, and set your system's DNS to point to this DNS server, or
temporarily trick the DNS resolution in your local system by registering whatever.yoursite.com with it's corresponding IP address in /etc/hosts file (in unix-like systems). There's an equivalent file in MS Windows systems, look for a file named hosts in C:\Windows\system32\drivers\etc.
I'd try with the latter first, as it's just a matter of adding a single line to a text file:
203.0.113.22 whatever.yoursite.com
You may need to restart your browser.

Related

How to access html file using local host [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
Please I need help with accessing my html/php file with localhost on my browser,i turn my xampp on and tried to access my html/php file,but it is still not working
That's what I keep getting everytime
The path component of the URL to your file starts at the directory specified in the DocumentRoot configuration option for your Apache HTTPD server. This probably defaults to the htdocs directory.
It doesn't start at the root of your filesystem. Web servers do not, by default, expose every file on your hard disk to the network (which would be a scary default for security reasons).
Normally you don't have to enter xampp/htdocs in the link. localhost is reffering to your xampp htdocs folder "automatically". Try localhost/phpinvscode
If you put your index.html file in the htdocs folder directly you would only need to enter localhost in the browser.

Reduce server response time - apache2 on debian 7 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have pretty well-optimized website, PageSpeed Insights tool shows good results, but Google keeps saying reduce server response time which is 0.46 seconds. And it must not be greater than 200ms.
I have tried to delete all my htaccess content, then replace index.php with an empty index.html file, but server response remained the same. I am using a virtual private server with Debian 7and storing 2 websites with SSL on different IP addresses. The second site responds perfectly in 144 ms.
So, I can't find the reason why one site loads under 200ms and other in 460ms. I'm pretty sure that server has enough resources.
I would be grateful for the ideas.
You could try some tweaks on your apache server. Can't guarantee that you'll get the desired result but it's an easy job and I think you have nothing to lose if you try it! So edit your apache2.conf file and adjust your actual settings to match the ones bellow (these are good settings in terms of web server security as well).
TraceEnable Off
ServerSignature Off
ServerTokens Prod
FileETag None
HostnameLookups Off # this is important since your apache server won't try to translate your ip address into a dns name or host when you access your website
ExtendedStatus On # you can enable it afterwards, if you need it
Timeout 10
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
You could also disable apache modules (modules that you do not need or use). By default apache loads a big list of modules and I am pretty sure that you won't be needing them all. I can't provide you a list with what to keep enabled or what to disable but you can do a little Google research and based on your website you could decide what to disable and what to keep.
I am actually using all these settings on my CentOS 6.8 linux box and all the settings are in httpd.conf. On Debian you should edit /etc/apache2/apache2.conf and maybe some other files!

Server fault issue [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I am trying to link to a specific page within a PDF.
For desktop the URL works with:
https://www.examsolutions.net/papers/edexcel/gcse/nov17/paper2/paper2QUE.pdf#page=3
It takes you to page three, but does not work on mobile. However if I use jQuery
if ($(window).width() < 600) {
$("a").each(function(){
var newUrl = $(this).attr('href').replace('page=', 'page');
$(this).attr('href', newUrl);
});
}
The URL is changed to:
https://www.examsolutions.net/papers/edexcel/gcse/nov17/paper2/paper2QUE.pdf#page3
The removeal of the '=' works, but only on iOS. Is there a solution for Android or is it not possible due to Adobe PDF licenseing etc?
Option A is fine - do that.
It depends what the set up is on your new hosting...
If you have cPanel you can add the old domain as a parked domain - takes 30 seconds to set up - then just point your name servers/DNS the new hosting.
Alternatively you can set up the old site on your new hosting, then do a 301 redirect in the .htaccess file pointing it to your new domain.
http://css-tricks.com/snippets/htaccess/301-redirects/
Thanks for all the helpful guidance, I took it all on board and thought I would post back what I actuall did incase someone else needs a breakdown. To be clear, my hosting is a VPS on a LAMP stack running Ubuntu.
Repointed the a-record of the old site to the new one.
Created a config file in the sites-available folder of apache2
Pointed that config file to where I wanted the hosted folder to be,
in my case home/www/vhosts/
Created a folder in the above in the name of the old website
Added the .htaccess file in that folder with the 301 redirect in it.
Made the website active my using the a2ensite command
Restarted apache

How can I change host Name for Apache tomcat server? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I installed Apache Tomcat 6.0,I tested with simple Application it's working fine.but every time I calling my app with localhost:8080 in the browser.
I want to change host name(localhost) to something like subbu.for this I tried in the following way.
I open command prompt and entered drivers and after selected etc folder, open host file .in this file I changed subbu instead of localhost.After did this I restarted my system and started apache server and entered in my browser like subbu:8080.it's not working.
I hope,you understand what I faced problem.
How can I resolve this.
In /etc/hosts change the line
127.0.0.1 localhost
to be
127.0.0.1 localhost subbu

How can one reference subdomains on a dev server that also correctly resolve on a production server? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I've got a LAMP dev server at something like dev.example.com. Eventually this will be replicated to something like www.example.com where we will have root access.
I'd like to have the sys admin set up a few subdomains (e.g., subdomain1.example.com) such that they will work on both the dev server and the production server without the references to those subdomains having to be rewritten.
Can Apache be configured on the dev and production servers such that my code can reference something like subdomain1.localhost? Is there some other way of doing this?
(The servers will run recent versions of CentOS and the AMP stack.)
I finally found the answer in the CDN module. As the name implies, this is intended to be used with content delivery networks but essentially all it does is a rule-based re-writing of the URLs that Drupal outputs. I've used it to re-write URLs so that different file types can be served from unique hostnames (again, to maximize parallel downloads).
reading your question again, I think that you want your code to always return subdomain1.localhost, and you want apache to somehow change this to subdomain1.example.com on your production server.
You could do this with ProxyPassReverse, although you might have to run two copies of Apache if the subdomain1 is on the same machine. (I don't know if Apache will cope with talking to itself here). This is an expensive solution.
Instead, I recommend your parameterize your code.
On rails stacks, the easiest way to do this with the production.rb cp that capistrano recommends, and you might want to investigate similar ways of deploying your PHP code.