Configure VirtualHost for a perfect Wordpress Environment [closed] - wordpress

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/

Related

Apache Server to serve WordPress and Normal sites on different port [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 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.

I got server error when using Bitnami Wordpress

I manage 3 websites on one server instance. I set the Bitnami.conf like below
<VirtualHost *:80>
ServerName morethanair.com
ServerAlias morethanair.com
DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"
<Directory "/opt/bitnami/apps/wordpress/htdocs">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
# Bitnami applications installed with a prefix URL (default)
Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
</VirtualHost>
<VirtualHost *:80>
ServerName microblog.morethanair.com
DocumentRoot "/opt/bitnami/apps/wordpress/microblog-wordpress/"
<Directory "/opt/bitnami/apps/wordpress/microblog-wordpress/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
# Bitnami applications installed with a prefix URL (default)
Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
</VirtualHost>
<VirtualHost *:80>
ServerName photo.morethanair.com
DocumentRoot "/opt/bitnami/apps/wordpress/photo-wordpress/"
<Directory "/opt/bitnami/apps/wordpress/photo-wordpress/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
# Bitnami applications installed with a prefix URL (default)
Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
</VirtualHost>
I can connect 2 sites with subdomain (photo.morethanair.com and microblog.morethanair.com), but the server error occurred when I try to connect morethanair.com.
When I type 'morethanair.com' in the browser, the URL changes to 'morethanair.com//' with double slash.
Any idea to resolve this?
I already tried to delete Wordpress and all plug-ins and reinstalled the latest Wordpress, but it didn't work.
Thank you.

Wordpress .htaccess acting weird [closed]

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?

editing httpd.conf on apache

I'm trying to make my apache visible on my local network for being able to acces my wordpress site hosted there, by editing httpd.conf file on /bin/apache/conf/ and im getting a Permision Error, but I can't find any clear content on the Internet.
Im using UWAMP 3.1.0 and It must be something related with this part of the code:
<VirtualHost *:80>
#UWAMP Generate Virtual Host
DocumentRoot "F:/UwAmp/www/"
ServerName "main-serveur"
Alias "/mysql/" "F:/UwAmp/phpapps/phpmyadmin/"
Alias "/mysql" "F:/UwAmp/phpapps/phpmyadmin/"
Alias "/uwamp/" "F:/UwAmp/phpapps/uwamp/"
Alias "/uwamp" "F:/UwAmp/phpapps/uwamp/"
<Directory "F:/UwAmp/phpapps/phpmyadmin/">
AllowOverride All
Options FollowSymLinks Includes Indexes
Require local
</Directory>
<Directory "F:/UwAmp/phpapps/uwamp/">
AllowOverride All
Options FollowSymLinks Includes Indexes
Require local
</Directory>
<Directory "F:/UwAmp/www/">
AllowOverride All
Options FollowSymLinks Indexes
Require local
</Directory>
more concretely at the end:
<Directory "F:/UwAmp/www/">
AllowOverride All
Options FollowSymLinks Indexes
Require local
</Directory>
This is what I get after entering the IP where the site is hosted.
sorry for asking something so simple but I'm learning
Thank you in advance
{ONLINE_MODE}
If UwAmp is on Online mode, your website is available for all.
{ONLINE_MODE} will be replaced by :
Order allow,deny
Allow from all
If UwAmp is on Offline mode, your website is available only for your computer.
{ONLINE_MODE} will be replaced by :
Order deny,allow
Allow from 127.0.0.1 localhost

Drupal vhost file not displaying website content

I have used virtualhost file in drupal to create multiple sites under one server. Also to remove /drupal from the url.
ex: 202.45.198.98/drupal this is how my URL looks like when ever I visit my website
After creating new Virtual host file for my website, I can see my website without /drupal in url.
Now the problem only the first page is loaded I mean some matter but not images, drupal template or any other links.
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName mysite
DocumentRoot /var/www/drupal
<Directory /var/www/drupal/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory /var/www/drupal/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin/">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
You should check the settings.php inside sites/default folder. You will see a line something like --
# $base_url = 'http://www.example.com'; // NO trailing slash!
Remove the hash at the start & update the URL with the current URL you have for the drupal instance. Most probably you will solve your problem if your connection setting is correct at the same settings.php file (DB name, server name, username & password).
If you find problem due to clean URL in logging in then you may have to put manual path for logging in as admin, which will be --
YOUR_BASE_URL/?q=user/login
If you want to disable clean URL then you can write a extra line in your settings.php --
$conf = array(
'clean_url' => 0,
);
Have nice drupling :)

Resources