Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I created a WP site in WP Local and was just testing the deployment process. I exported it using WP Local itself and uploaded the app/public folder which contain the wp-admin, wp-content, wp-includes and all of its files.
Configure wp-config for the db connection, manually set my siteurl & home to match the domain (atm, its a subdomain so I use this one). It's also SSL through cloudflare so I'm using https:// as prefix.
I went into admin panel, settings - general and checked the URL for home and site and clicked save just to be certain for cache. Then I went settings - permanlinks and saved all there.
Result -> Homepage works, others don't (wp-admin does) so I thought my mod rewrite was not working.
Mod rewrite module is activated and these are my apache conf:
<VirtualHost *:80>
ServerAdmin myemail#test.be
ServerName subdomain.domain.be
DocumentRoot /var/www/wp-root-path
<Directory /var/www/wp-root-path>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost"
</FilesMatch>
ErrorLog ${APACHE_LOG_DIR}/subdomain.domain.be.error.log
CustomLog ${APACHE_LOG_DIR}/subdomain.domain.be.access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerAdmin myemail#test.be
ServerName subdomain.domain.be
DocumentRoot /var/www/subdomain.domain.be
ErrorLog ${APACHE_LOG_DIR}/subdomain.domain.be.error.log
CustomLog ${APACHE_LOG_DIR}/subdomain.domain.be.access.log combined
SSLEngine on
SSLCertificateFile /etc/cloudflare/path-to-cloudflare.pem
SSLCertificateKeyFile /etc/cloudflare/path-to-cloudflare.key
</VirtualHost>
I tried change permalink settings, deleting the .htaccess file (on save it regenerated it), the permissions of the .htaccess is 644..
Everything looks good to me, yet it isn't? Any tips? Thanks in advance!
DocumentRoot /var/www/wp-root-path
<Directory /var/www/wp-root-path>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost"
</FilesMatch>
Your <VirtualHost *:443> container seems to be missing half the necessary config directives?
Your vHost:443 container is setting a different DocumentRoot? You are also failing to allow .htaccess overrides in the vHost:443 container so any "pretty" permalinks are going to fail (404). And you are not permitting access either.
I would assume you are on Apache 2.4 (not Apache 2.2), so you should be using Require all granted, instead of the deprecated Order and Allow directives.
You are also missing the SetHandler directive in the vHost:443 container?
Related
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 10 months ago.
Improve this question
I have installed Apache/2.4.4 in my ubuntu 21. I have already had a website in this IP: 172.20.x.y is listening to port 80 i.e the default port. It doesn't have a domain name yet. I have mentioned its document root below,
DocumentRoot: /var/www/html
I plan to use port 81 to run WordPress on the same machine.
DocumentRoot: /srv/www/wordpress
I tried to update the 000.default.conf file to support that. Below are the codes I changed.
Listen 81
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/htm
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:81>
ServerAdmin webmaster#localhost
DocumentRoot /srv/www/wordpress
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /srv/www/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Require all granted
</Directory>
</VirtualHost>
However, when I access the 172.20.x.y:81, it will redirect to the default port.
Wordpress doesn't work,
when I disable 000.default.conf and run only WordPress.conf it works fine.
<VirtualHost *:80>
DocumentRoot /srv/www/wordpress
<Directory /srv/www/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Require all granted
</Directory>
<Directory /srv/www/wordpress/wp-content>
Options FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
Can anyone help fix this problem?
I would recommend checking the Site/Home URL of your WordPress. Make sure to change the Site/Home URLs to match the port, for example, if your URL is currently "http://localhost" ( 80 HTTP port by default ) it is absolutely normal behavior to see a redirection occur when you attempt to visit "http://localhost:81".
Please try adding ":81" at the end of your WordPress URL and see how it goes.
I do not know how it works, but it works. I erased all the changes I had made and started doing it all over again.
Now I did not touch the 000-default.conf file, I just added the wordpress.conf file and wrote vhost code mentioned below in it.
Listen 81
<VirtualHost *:81>
ServerAdmin webmaster#localhost
DocumentRoot /srv/wordpress
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Let me test the Apache syntax by running the $apache2ctl configtest command, it shows syntax ok.
Then I reload the apache server by running $service apache2 reload;
Finally, I open 172.20.x.y:81, which says "You do not have permission to access", At which point I uncommnent some parts of code on apache2.conf file at /etc/apache2/.
It was like
# <Directory /srv/>
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
# </Directory>
Changed to
<Directory /srv/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Again I reload the Apache server. Finally, it works properly.
If I use my safari browser, I cannot get to my website example.com. I have to use www.example.com for it to work. I tried editing htaccess numerous times and still, it doesn't work.My website is using bitami wordpress image (https://docs.bitnami.com/)which is hosted in AWS.
Bitnami Engineer here:
By default, we disable .htaccess files due to security and performance reasons. We also move .htaccess files content to a file called htaccess.conf in the folder /opt/bitnami/apps/wordpress/conf. You can check more about it at https://docs.bitnami.com/aws/infrastructure/lamp/administration/use-htaccess/.
If you want to enable .htaccess usage, you would need to set it to AllowOverride All in /opt/bitnami/apache2/conf/bitnami/bitnami.conf file:
<VirtualHost _default_:80>
DocumentRoot "/opt/bitnami/apache2/htdocs"
<Directory "/opt/bitnami/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All <---- HERE
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3 >
Require all granted
</IfVersion>
</Directory>
And restart Apache after applying your changes.
For more info, find WordPress documentation below:
https://docs.bitnami.com/aws/apps/wordpress/
Regards
Good day:
I have my website in digitalOcean, in Ubuntu Droplet. I have both Wordpress site and CakePHP sites. CakePHP is working well.
Wordpress I have a little issue:
If I access for example www.mywebpage.cl then it shows my "Apache2 Ubuntu Default Page" page (apache1.jpg attached):
If I access on my browser:
http://www.mywebpage.cl/alianzaWordpress/datos1/ then it goes to my webpage (mysite.jpg).
I want to go to www.mywebpage.cl and automatically directs to http://www.mywebpage.cl/alianzaWordpress/datos1/
I have tried to modify /etc/apache2/sites-available/000-default.conf with no success.
I have tried set DocumentRoot as /var/www/html/alianzaWordpress/datos1 or but still not working properly
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
#DocumentRoot /var/www/html/alianzaWordpress/datos1
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
After I modify I do "a2enmod rewrite ; service apache2 restart"
enter image description here
Please any recommendation is fine for me, also I am using permalinks "post names" in my site. (permalinks.jpg)
Regards,
Felipeenter image description here
Pictures
I found something easy to do, thanks anyway.
I modifed this file /var/www/html/index.html with this information to redirect to the folder I wanted:
<meta http-equiv="Refresh" content="0; url=http://www.mywebpage.cl/alianzaWordpress/datos1/">
Sorry for easy question, now I learn, Regards,
Felipe
Issue: I cannot make the webserver host multiple websites.
Solutions I have tried:
I made two different Vhost.conf for the different websites(named differently according the website name but with the .conf extension. I then targeted different document roots linked to the websites within these config files. – Failed, displayed “connection refused”
I then went to the second website directory I created and change the file permissions to 755 (and 777 just incase) to check if that was conflicting and creating the issue, this also failed and made the same error.
Also all files have “chown -R root:root dir/ “ on.
I then went on to open port 8080 in iptables and changed the targeted port in the vhost of the second website to 8080, this also failed with the same error.
I tried finding the second website using “ip:8080, ip/secondwebsitedirectory, ip:80/secondwebsitedirectory” none of these worked. I followed each step of multiple tutorials online and none of these worked.
When I tested just making a directory and displaying the <?php phpinfo; ?> in index.php within the directory, then targeting that with the document root of the first virtual host block, this worked but did not display the second block’s website (I used the domain to link the alias to this and forwarded the domain to the servers ip).
My current vhost.conf file looks like this **NOTE: I removed ip’s and domains on clients request. They do work and have been tested so that isn’t an issue. Anything with “testsite” was originally the clients domain. **
I have made it two separate VirtualHost blocks previously and had the same result as I am having currently, I have had <VirtualHost *:80> on both blocks too.
<VirtualHost *>
ServerAdmin webmaster#testsite.org
ServerName ea
ServerAlias *server ip was here*
DocumentRoot /var/www/html/ea
ErrorLog /var/www/html/ea/logs/error.log
CustomLog /var/www/html/ea/logs/access.log combined
ServerAdmin webmaster#testsite.org
ServerName testsite
ServerAlias www.testsite.co.uk
DocumentRoot /var/www/html/testsite/public_html
ErrorLog /var/www/html/testsite/logs/error.log
CustomLog /var/www/html/testsite/logs/access.log combined
</VirtualHost>
The end result I want to come to is to be able to host multiple sites on my cloud server, these website are using Wordpress as that is the development platform I have been instructed to use and the server is running Centos 6.8 with all php and apache2 installed and working on one website.
As to a conclusion to this, I am stumped and need your help.
You need one statment for each site you want
<VirtualHost ea.mydomain.com:80>
ServerAdmin webmaster#testsite.org
ServerName ea.mydomain.com
ServerAlias ea
DocumentRoot /var/www/html/ea
<Directory "/var/www/html/ea/">
Options FollowSymLinks Indexes
AllowOverride None
# Use require all granted for apache 2.4
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/www/html/ea/logs/error.log
CustomLog /var/www/html/ea/logs/access.log combined
</VirtualHost>
<VirtualHost testsite.mydomain:80>
ServerAdmin webmaster#testsite.org
ServerName testsite.mydomain
ServerAlias testsite.mydomain testsite
DocumentRoot /var/www/html/testsite/public_html
<Directory "/var/www/html/testsite/public_html">
Options FollowSymLinks Indexes
AllowOverride None
# Use require all granted for apache 2.4
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/www/html/testsite/logs/error.log
CustomLog /var/www/html/testsite/logs/access.log combined
</VirtualHost>
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'm trying to install wordpress in a Cloud Server with rackspace.
But my lack of knowledge in server configuration (LAMP , etc) is making me do a lot of miss configurations .
First I think the .httaccess is not allow.
Second the update Wordpress and plugins featured is not allow
Third may be more numbers...
let me show my virtualhost file:
<VirtualHost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin adrian#my.com
ServerName my.com
ServerAlias www.my.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html, index.php
DocumentRoot /home/devdreams/domains/my.com/public
# Custom log file locations
LogLevel warn
ErrorLog /home/devdreams/domains/my.com/log/error.log
CustomLog /home/devdreams/domains/my.com/log/access.log combined
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Satisfy all
</Directory>
AccessFileName .htaccess
<Directory /home/devdreams/domains/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
LoadModule rewrite_module modules/mod_rewrite.so
</VirtualHost>
Could somebody help me configure my VH for a wordpress environment
thaaks
Your .htaccess will not work because you have AllowOverride None, change that to AllowOverride All
In terms of being able to update Wordpress and the plugins you will need to change the ownership of the files/directories to the user that is running the webserver. For example: chown -R apache:apache /home/devdreams/domains/