Cannot install Wordpress Multisite (Network) on a custom port - apache

I'm running a website at http://localhost:8080/sitename. However, when I'm trying to create a network of sites with wordpress, I'm getting the following error under Tools-> Network:
ERROR: You cannot install a network of sites with your server address.
You cannot use port numbers such as :8080.
I tried to create a virtual host and a fake domain but I can't make it work.
How can I solve that?

At this moment, Wordpress only seem to support 80 and 443 ports. A temporary possible workaround to use any custom (i.e. http 8080) port:
Open wp-admin/includes/network.php and find the section of code where it mentions array( ':80', ':443' ) and add :8080 too in that array.
After completing setup of network, you might need in wp-config to adjust to such:
define( 'DOMAIN_CURRENT_SITE', 'example.com'. (stristr($_SERVER['PHP_SELF'],'wp-login.php') ? '':':8080') );
As noted in comments (thanks) after creating first sub-site, it might have port number embedded in domain name, so try to enter Mysql Database (i.e. try hosting's phpMyAdmin, or even installed plugin before starting procedure) and in _blogs & _site& _options tables, to adjust homepage urls of subsites(i.e. separate port number from domain).
That's all. Login again to your project.

From my experience, WP is not designed to use custom ports for multi-sites so the blogs (sub-sites) hosts get messed up in the DB.
My solution: After you switch to multi-site or create a new site, you need to go to your db admin page (e.g. phpMyAdmin) and fix the blogs domain in the wp_blogs table. Basically WP failed to add a colon between the host and port; just have to add it-> localhost8080 becomes localhost:8080.
So, on the site's settings add the missing colon to the siteurl and home urls.

I found temporary solution:
running "netstat -o -n -a | findstr 0.0.80" in CMD will show you wich service is using the port 80. If PID is 4 it means that port 80 is used by the system (propably IIS or web matrix if it is installed - this was my case). i changed the port IIS was using from IIS Manager and i also deactivated MsDepSvc service (Web Matrix) which was also using port 80. After that i reconfigured apache to work in port 80 and everything worked OK!

Related

Can't access Apache Server through IPv6 from outside

My goal is simple : I just want to access my Apache Web server installed on a Ubuntu Server on a local PC behind my box in IPv6.
Using NAT, I can do it with IPv4 but it's a little bit "headache-able" to keep it work with a domain name and SSL. So I tried to make it work with IPv6, the IPv6 of my server is public and I just have to complete the AAAA of the domain name.
The problem is : I searched and tried a lot of things, I learned a lot but the problem is still complete !
The situation :
Ubuntu server shows the good IPv6 adress when I do hostname -I
I can ping my machine using a external website (dnschecker for example) from and outside my local network DNSchecker capture
Apache is configured to use IPv6 adresses and serve pages when asked from the local network BUT it does NOT work when accessed from outside (my problem !)
ufw is configured to use IPv6 tables, allows Apache then Apache Full ufw status
no firewall on my internet box
I'm dry, I don't know what to look for in order to solve this problem. I need help, thanks for your ideas and advices.

How to configure custom hostname to IP resolutions in my system for web development

Preface
A web app can potentially
serve different pages,
depending on the
hostname
that is requested by the browser,
even if all hostnames are resolved
to the same
IP address.
Example
For example, at
https://app.example.com,
which resolves to
1.2.3.4,
users will find the user interface
and at
https://admin.example.com,
which also resolves to
1.2.3.4,
awaits a dashboard
through which
only the app's owner can
administrate users and data
in the app.
What We Need
In short,
we need to enter,
for example,
http://admin.app:8000/
in our browsers
and have that admin.app resolve to 127.0.0.1.
The Question
How can I configure
custom hostname to IP address resolutions
in my development environment?
(Ubuntu and Derivatives) Configure NetworkManager's dnsmasq
Ubuntu Desktop's default networking configuration is
composed of NetworkManager and its slave dnsmasq.
The slave dnsmasq listens at 127.0.1.1 and /etc/resolv.conf lists it as the only nameserver.
This has
some benefits.
What it means for this purpose is that we have a fully configurable DNS server, comfortably configured by default.
We can create
/etc/NetworkManager/dnsmasq.d/hosts.conf
and put in it whatever address statements we'd like:
address=/admin.app/127.0.0.1
We can even use wildcards!
address=/.app/127.0.0.1
See the
dnsmasq documentation
for details
(look for --address).
Since dnsmasq is started by the network-manager service,
then I would assume that the following would restart it
so that new configuration would take effect:
$ service network-manager restart
But its init-script does not control slave dnsmasq.
Therefore the dnsmasq process must be killed and then
the above command would have it start again.
And that is it!
(Linux) User Specific HOSTALIASES File
Very limited
This would have been my preferred answer
because
it refrains from
altering system configuration.
But:
It does not support wildcards
It does not support hostname to IP address resolution
It does not support freely configurable subdomains
It will not work if you have a local DNS server,
which is the case in modern Ubuntu.
What is It
It is a user specific host aliases file.
Notice that the format is not the same as the hosts file.
In short, you create a file
which contains host aliases.
For example
foo localhost
bar localhost
and place it at ~/.hosts.
Then you set an environment variable
HOSTALIASES
with the path to the aliases file.
So, for this example
$ export HOSTALIASES=~/.hosts
If Testing In a Virtual Machine
In a virtual machine
127.0.0.1 and localhost
will not reach the host,
but the guest.
In VirtualBox, for example,
by default, the host can be reached
at 10.0.2.2.
So, the guest VM's hosts file can look like
10.0.2.2 host
10.0.2.2 app.host
10.0.2.2 admin.host
Proxy DNS Nameserver Inside a Virtual Machine
If you're setting up
a proxy DNS nameserver
inside a virtual machine
(perhaps for wildcard support in Windows)
the upstream nameserver
is usually provided by the host.
In VirtualBox, it is 10.0.2.3.
(Windows) Configuring Acrylic DNS Server
Acrylic DNS Proxy is easy to install and configure.
It can help us get hostnames with aliases quickly in Windows.
And it is open source.
Install it.
Open the hosts file (via the start menu entry).
Put in some entries, like 1.2.3.4 >app.
Clear its cache and restart it (via the start menu entry).
Set your DNS server to 127.0.0.1.
(Windows, Linux, OSX) System Wide Hosts File
Simply edit the
hosts file.
Its location
depends on the OS.
For example:
127.0.0.1 app.localhost
127.0.0.1 admin.localhost
On Windows you can use
this nifty open source GUI
for editing the hosts file:
Hosts File Editor.
Wildcards
The hosts file does not support wildcards!
Ubuntu Desktop
Since Ubuntu 12.04,
Ubuntu desktop comes with
a local DNS server,
which might not respect
the hosts file (/etc/hosts).
So, for Ubuntu desktop, this answer
is best.
(GNU/Linux)
Since all the major distributions are migrating (or already did) to systemd stack the proper place to implement wildcard support would be systemd-resolved: see https://github.com/systemd/systemd/issues/766 for details.
That would be the place to set custom overrides for DNS as well.
As for windows - its VM should just get DNS from host machine: it's to risky to run it on bare metal anyway.

Unable To Connect To MAMP Server From Other Devices

I have MAMP PRO running locally on my machine (Mavericks). I can connect find to localhost and apache is running on port 80.
The test website I have set up is served. I can browse to it via http:// my-local-host (have to put a dash in because stack exchange doesn't like URLs) or http://mymachinename.local or http://XXX.XXX.X.XX (my ipaddress).
It's not working remotely though from either iPhone or iPad. I have tried turning off the firewall. I have tried adding a rule to the firewall to allow incoming connections to httpd. Neither work.
I also have Little Snitch installed. I tried turning off Little snitch and also creating a rule to allow traffic through to port 80 via httpd. Neither work.
Anyone else had similar issues and found a resolution?
The problem is DNS.
MAMP writes your Hosts to /etc/hosts.
Example:
127.0.0.1 example.com
Your Iphone's host file has no such entry. This is why it does not work.
You need e.g. a "DNS-server", which you can enter in
Settings - Wlan - static as Router on your phone.
I think your problem would be addressed if you use the Dynamic DNS option in MAMP PRO. Then, using a third party company like noIP.com, you could setup myTestBox.ddns.net and pull up your website on your iPad.

DNS problem - dig resolves but curl cannot connect to host

I have recently created a Rackspace cloud server instance using CentOS 5.5. I have used yum to install the "Web Server" group (it includes Apache, etc.), added www.booztrakr.com as the ServerName in httpd.conf, made sure iptables allows on port 80. I had registered this domain with Go-Daddy and changed their name servers to the Rackspace name servers on their site. I added "A" and CNAME records to the Rackspace name servers. httpd has been started. When I use curl on the server I can get the Apache landing page. When I dig www.booztrakr.com from a remote machine(over the internet) the answer section returns:
www.booztrakr.com. 300 IN CNAME booztrakr.com.
booztrakr.com. 300 IN A 184.106.216.156
When I try a browser or curl, it can't connect:
curl -G www.booztrakr.com
curl: (7) couldn't connect to host
I know this has got to be pretty basic and config related but I'll be dammed if I can see it. Any help would be appreciated. Thanks.
If dig resolves, this just means the DNS server returns the right values. It will even work if the IP doesn't exists.
If a HTTP connecting to the server fails, this is a configuration problem.
The server responds to ICMP requests, so it's not a routing problem.
When I use curl on the server I can get the Apache landing page
Your webserver is running, but you just can't reach it from outside. This is the problem. What does iptables --list outputs?

Apache and IIS side by side (both listening to port 80) on windows2003

What are some good ways to do this? Is it even possible to do cleanly?
Ideally I'd like to use packet headers to decide which server should handle requests. However, if there is an easier/better way let me know.
It's impossible for both servers to listen on the same port at the same IP address: since a single socket can only be opened by a single process, only the first server configured for a certain IP/port combination will successfully bind, and the second one will fail.
You will thus need a workaround to achieve what you want. Easiest is probably to run Apache on your primary IP/port combination, and have it route requests for IIS (which should be configured for a different IP and/or port) to it using mod_rewrite.
Keep in mind that the alternative IP and port IIS runs on should be reachable to the clients connecting to your server: if you only have a single IP address available, you should take care to pick an IIS port that isn't generally blocked by firewalls (8080 might be a good option, or 443, even though you're running regular HTTP and not SSL)
P.S. Also, please note that you do need to modify the IIS default configuration using httpcfg before it will allow other servers to run on port 80 on any IP address on the same server: see Micky McQuade's answer for the procedure to do that...
I found this post which suggested to have two separate IP addresses so that both could listen on port 80.
There was a caveat that you had to make a change in IIS because of socket pooling. Here are the instructions based on the link above:
Extract the httpcfg.exe utility from the support tools area on the Win2003 CD.
Stop all IIS services: net stop http /y
Have IIS listen only on the IP address I'd designated for IIS: httpcfg set iplisten -i 192.168.1.253
Make sure: httpcfg query iplisten (The IPs listed are the only IP addresses that IIS will be listening on and no other.)
Restart IIS Services: net start w3svc
Start the Apache service
For people with only one IP address and multiple sites on one server, you can configure IIS to listen on a port other than 80, e.g 8080 by setting the TCP port in the properties of each of its sites (including the default one).
In Apache, enable mod_proxy and mod_proxy_http, then add a catch-all VirtualHost (after all others) so that requests Apache isn't explicitly handling get "forwarded" on to IIS.
<VirtualHost *:80>
ServerName foo.bar
ServerAlias *
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8080/
</VirtualHost>
Now you can have Apache serve some sites and IIS serve others, with no visible difference to the user.
Edit: your IIS sites must not include their port number in any URLs within their responses, including headers.
You need at least mod_proxy and mod_proxy_http which both are part of the distribution (yet not everytime built automatically). Then you can look here: http://httpd.apache.org/docs/2.2/mod/mod_proxy.html
Simplest config in a virtualhost context is:
ProxyPass /winapp http://127.0.0.1:8080/somedir/
ProxyPassReverse /winapp http://127.0.0.1:8080/somedir/
(Depending on your webapp, the actual config might become more sophisticated. )
That transparently redirects every request on the path winapp/ to the windows server and transfers the resulting output back to the client.
Attention: Take care of the links in the delivered pages: they aren't rewritten, so you can save yourself lotsa hassle if you generally use relative links in your app, like
<a href=../pics/mypic.jpg">
instead of the usual integration nightmare of every link being absolute:
<a href="http://myinternalhostname/somedir/crappydesign.jpg">
THE LATTER IS BAD ALMOST EVERY SINGLE TIME!
For rewriting links in pages there's mod_proxy_html (not to confuse with mod_proxy_http!) but that's another story and a cruel one as well.
Either two different IP addresses (like recommended) or one web server is reverse-proxying the other (which is listening on a port <>80).
For instance: Apache listens on port 80, IIS on port 8080. Every http request goes to Apache first (of course). You can then decide to forward every request to a particular (named virtual) domain or every request that contains a particular directory (e.g. http://www.example.com/winapp/) to the IIS.
Advantage of this concept is that you have only one server listening to the public instead of two, you are more flexible as with two distinct servers.
Drawbacks: some webapps are crappily designed and a real pain in the ass to integrate into a reverse-proxy infrastructure. A working IIS webapp is dependent on a working Apache, so we have some inter-dependencies.
I see this is quite an old post, but came across this looking for an answer for this problem. After reading some of the answers they seem very long winded, so after about 5 mins I managed to solve the problem very simply as follows:
httpd.conf for Apache leave the listen port as 80 and 'Server Name' as FQDN/IP :80.
Now for IIS go to Administrative Services > IIS Manager > 'Sites' in the Left hand nav drop down > in the right window select the top line (default web site) then bindings on the right.
Now select http > edit and change to 81 and enter your local IP for the server/pc and in domain enter either your FQDN (www.domain.com) or external IP close.
Restart both servers ensure your ports are open on both router and firewall, done.
This sounds long winded but literally took 5 mins of playing about. works perfectly.
System:
Windows 8, IIS 8, Apache 2.2
Installing Windows 10 I had this problem: apache(ipv4) and spooler service(ipv6) listening the same 80 port.
I resolved editing apache httpd.conf file changing the line
Listen 80
to
Listen 127.0.0.1:80
That's not quite true. E.g. for HTTP Windows supports URL based port sharing, allowing multiple processes to use the same IP address and Port.
You will need to use different IP addresses. The server, whether Apache or IIS, grabs the traffic based on the IP and Port, which ever they are bound to listen to. Once it starts listening, then it uses the headers, such as the server name to filter and determine what site is being accessed. You can't do it will simply changing the server name in the request