virtualhost – Apache2 sends a virtual host with a corresponding server name to another virtual host

I have two separate domains on which I want to host two different servers. I have both configuration files set up, but the problem is; going to my second domain in my browser sends me to the first virtual host and all its files. I'm not sure what can cause this, because I'm new in most things on Apache, so I'll put both configuration files here.

Site 1:

NomVirtualHost *: 80
Listen *: 80

    ServerAdmin admin@site1.site
ServerName site1.site
ServerAlias ​​www.site1.site
DocumentRoot /var/www/site1.site/html
ErrorLog $ {APACHE_LOG_DIR} /error.log
CustomLog $ {APACHE_LOG_DIR} /access.log combined

Site 2:

LoadModule vhost_alias_module modules / mod_vhost_alias.so
LoadModule modules rewrite_module / mod_rewrite.so
NomVirtualHost *: 443
Listen to 443

        ServerName site2.site
ServerAlias ​​* .site2.site
ErrorLog $ {APACHE_LOG_DIR} /site2/SSL_error.log
TransferLog $ {APACHE_LOG_DIR} /site2/SSL_access.log
VirtualDocumentRoot "/ var / www / site2 /% 1"

SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ALL :! DH :! EXPORT :! RC4: + HIGH: + MEDIUM :! LOW :! Anüll :! eNULL

SSLCertificateFile /etc/letsencrypt/live/site2.site/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/site2.site/privkey.pem
        
                   SSLOptions + StdEnvVars
        

        SetEnvIf User-Agent ". * MSIE." "Nokeepalive ssl-unlean-shutdown downgrade-1.0 force-response-1.0 ~
        
                Options + Index + FollowSymLinks -MultiViews
UseCanonicalName Off
AllowOverride All
Allow everyone
RewriteEngine On
RewriteCond% {HTTP_HOST} ^ (. *) . Site2  .site $ [NC]
                RewriteCond /var/www/site2.site/%1! -D
RewriteRule ^ (. *) Https://404.site2.site/
        
        
                
                
                
                Options + Index + FollowSymLinks -MultiViews
UseCanonicalName Off
AllowOverride All
Allow everyone
        

        
                
                
                
                UseCanonicalName Off
Order allow, refuse
Allow everyone
        

What I mean by that, is that the site 2 m sends to site 1, not as a redirect, but that it actually loads all its files. Maybe I did something wrong?

apache2 – error while installing php in Ubuntu

I'm trying to install php on my Ubuntu system. I've already installed apache and mysql, but I can not install php with the following command

sudo apt install php libapache2-mod-php

I receive the following error:

(Reading the database ... 489 files and directories currently installed.)
Preparing for decompression ... / libapache2-mod-php_2% 3a7.3 + 69 + ubuntu18.10.1 + deb.sury.org + 2 + php7.3_all.deb ...
Unpacking libapache2-mod-php (2: 7.3 + 69 + ubuntu18.10.1 + deb.sury.org + 2 + php7.3) ...
Setting up php7.3-common (7.3.3-1 + ubuntu18.10.1 + deb.sury.org + 1) ...
dpkg: php7.3-common (--configure) error-handling package:
The post-installation script subprocess of the installed php7.3-common package returned the error status 10
dpkg: dependency problems prevent php7.3-opcache configuration:
php7.3-opcache depends on php7.3-common (= 7.3.3-1 + ubuntu18.10.1 + deb.sury.org + 1); however:
The php7.3-common package is not configured yet.

dpkg: php7.3-opcache (--configure) error-handling package:
dependency issues - leave unconfigured
dpkg: dependency problems prevent libapache2-mod-php7.3 configuration:
libapache2-mod-php7.3 depends on php7.3-common (= 7.3.3-1 + ubuntu18.10.1 + deb.sury.org + 1); however:
The php7.3-common package is not configured yet.
libapache2-mod-php7.3 depends on php7.3-opcache; however:
The php7.3-opcache package is not configured yet.

dpkg: libapache2-mod-php7.3 (--configure) error-handling package:
dependency issues - leave unconfigured
No split report written because the error message indicates that it is an error following a previous failure.
No split report written because the error message indicates that it is an error following a previous failure.
dpkg: dependency problems prevent php7.3-cli configuration:
php7.3-cli depends on php7.3-common (= 7.3.3-1 + ubuntu18.10.1 + deb.sury.org + 1); however:
The php7.3-common package is not configured yet.
php7.3-cli depends on php7.3-opcache; however:
The php7.3-opcache package is not configured yet.

dpkg: php7.3-cli (--configure) error-handling package:
dependency issues - leave unconfigured
No distribution report written because MaxReports is already reached
dpkg: dependency problems prevent php7.3-readline configuration:
php7.3-readline depends on php7.3-common (= 7.3.3-1 + ubuntu18.10.1 + deb.sury.org + 1); however:
The php7.3-common package is not configured yet.

dpkg: php7.3-readline (--configure) error-handling package:
dependency issues - leave unconfigured
No distribution report written because MaxReports is already reached
dpkg: dependency problems prevent php7.3 configuration:
php7.3 depends on libapache2-mod-php7.3 | php7.3-fpm | php7.3-cgi; however:
The package libapache2-mod-php7.3 is not configured yet.
The php7.3-fpm package is not installed.
The php7.3-cgi package is not installed.
php7.3 depends on php7.3-common; however:
The php7.3-common package is not configured yet.

dpkg: package php7.3 (--configure) processing error:
dependency issues - leave unconfigured
No distribution report written because MaxReports is already reached
dpkg: dependency problems prevent php7.3-json configuration:
php7.3-json depends on php7.3-common (= 7.3.3-1 + ubuntu18.10.1 + deb.sury.org + 1); however:
The php7.3-common package is not configured yet.

dpkg: php7.3-json (--configure) error-handling package:
dependency issues - leave unconfigured
No distribution report written because MaxReports is already reached
dpkg: dependency problems prevent libapache2-mod-php configuration:
libapache2-mod-php depends on libapache2-mod-php7.3; however:
The package libapache2-mod-php7.3 is not configured yet.

dpkg: package libapache2-mod-php (--configure) processing error:
dependency issues - leave unconfigured
No distribution report written because MaxReports is already reached
dpkg: dependency problems prevent php configuration:
php depends on php7.3; however:
The php7.3 package is not configured yet.

dpkg: package php processing error (--configure):
dependency issues - leave unconfigured
No distribution report written because MaxReports is already reached
Errors were encountered during treatment:
php7.3-common
php7.3-opcache
libapache2-mod-php7.3
php7.3-cli
php7.3-readline
php7.3
php7.3-json
libapache2-mod-php
php
E: The / usr / bin / dpkg subprocess returned an error code (1)

apache2 – Error in setoolkit with apache

I have an error in Setoolkit, I use ngrok + setoolkit for an external network, but after cloning, the page always appears. Msg:

[[[[]You may need to copy / var / www / in / var / www / html depending on the structure of your directory.
Press {return} if you understand what we are saying here.

and then, at the beginning, did anyone have the same problem?
I already tried to copy the files but it did not work.

apache2 – AH00037: Unauthorized symbolic link or non accessible link target

I've installed a new Ubuntu 18.10 on my old Dell replacement laptop.
I have installed apache2 and php that went well.
http: //localhost/phpinfo.php displays the phpinfo page.
phpinfo.php is at / var / www / html
I have also done sudo ln -s / home / anjanesh / Dropbox / www anjanesh
anjanesh -> / home / anjanesh / Dropbox / www /
But when I do http: // localhost / anjanesh / he gives 403.
But /var/log/apache2/error.log says
[Sun Mar 17 16:13:17.079030 2019] [core:error] [pid 1703] [client 127.0.0.1:60858] AH00037: Unauthorized symbolic link or unreachable link target: / var / www / html / anjanesh
I do not understand what's wrong because that's what I did on my Ubuntu 14.04 laptop.

ls -la
total 24
drwxr-xr-x 2 www-data www -data 4096 27 Jan. 11:37.
drwxr-xr-x 3 www-data www -data 4096 27 january 09:45 ..
lrwxrwxrwx 1 www-data www-data 27 january 27 10:51 anjanesh -> / home / anjanesh / Dropbox / www /
-rw-r - r-- 1 www-data www -data 10918 27 january 09:45 index.html
-rw-r - r-- 1 www-data www -data 77 27th January 11:37 phpinfo.php

The owner is www-data.

How can I activate sudo without a password for the apache2 service?

Problem: I do not see how to enable the use of the service apache2 with sudo without password. I can enable it for all user commands, but as this seems like a bad idea, I only want to activate some commands.

Context: I'm trying to configure a streaming distribution / deployment system, and in this context, I let Ansible execute some commands on the target computers. Some of these commands unfortunately require sudo and I have to remove the corresponding password prompt. Ideally, all permissions in this process work with saved keys instead of passwords.

configs:
(Machine names have been replaced with placeholder values.)

Machine target.example.com under Ubuntu 18.04 LTS and Apache 2.x

Machine control.example.com under Ubuntu 16.04 LTS and Ansible 2.7.8

File /etc/sudoers.d/ansible on machine target.example.com:

ansible ALL = NOPASSWD: / usr / sbin / service / usr / sbin / apache2 *

File / etc / ansible / hostson machine control.example.com:

[production]



target.example.com

File ~ / deploy.yml on machine control.example.com:

---
- hosts: production
remote_user: ansible

Tasks:
- name: stop apache
shell: service apache2 stop
become: yes
become_method: sudo
- name: start apache
shell: service apache2 start
become: yes
become_method: sudo

Additional information:
When running ansible-playbook ~ / deploy.yml sure control.example.com, I receive an error sudo: a password is required. I can reproduce the prompt for the password when connecting to the target via ssh ansible@target.example.com and then running sudo service apache2 stop and sudo service apache2 start. Therefore, I hesitantly state that the problem lies somewhere with the sudo configuration on target.example.com and Ansible is only the messenger.

I've tried different configurations of /etc/sudoers.d/ansiblemainly because I am not at all sure of the correct syntax and have tried all kinds of expressions to see what works. The only job I've found is ansible ALL = NOPASSWD: ALL, which I want to avoid for security reasons.

apache2 – Can I host two sites, one based on one domain and the other on ip, on the same Apache server?

I'm trying to host the example.com website on my current Ubuntu server.

I created the corresponding directories: /var/www/html/example.com/public_html

and within enabled sites, I've created example.com.conf


    
    
    
    ServerName example.com
ServerAlias ​​www.example.com
ServerAdmin webmaster@example.com
DocumentRoot /var/www/example.com/public_html

    
        Options -Indexes + FollowSymLinks
AllowOverride All
    

    ErrorLog $ {APACHE_LOG_DIR} /example.com-error.log
Combined CustomLog $ {APACHE_LOG_DIR} / example.com-access.log

Just change the DNS, so it will take some time to make sure this part works.

However, I am currently using the same server with only the IP address to perform some Perl scripts that they called by x.x.x.x / cgi-bin / perlscript.pl

And this part has stopped working.

The error log contains

AH01276: Can not serve directory / var / www / html /: No match
DirectoryIndex
(index.html, index.cgi, index.pl, index.php, index.xhtml, index.htm) found,
and Server-Generated Directory Indexes Denied by the Options Directive

So, since I just configured the conf file for the server based on the domain name, did I ruin it?

Can Ubuntu host two virtual servers where one is based on a domain name and the other on IP?

Thank you

server – Configuration of Apache2 VirtualHost to run multiple sites locally Ubuntu 16.04

I had a site I had been working on for a while in / var / www / html. I am starting a new project and want to manage another site locally.

After some research on Google, I checked the previous question: https://ubuntuforums.org/showthread.php?t=1423044

I created a folder in / var / www called my website and just cloned the repo git that i'm going to use there for the moment.

Then I added a file called my-site.com.conf at / etc / apache2 / sites-enabled. Here is what it looks like:





Webmaster ServerAdmin @ localhost
ServerName www.my-site.com
DocumentRoot / var / www / my-site /

    FollowSymLinks options
AllowOverride None


    
    
    
    Options Index FollowSymLinks MultiViews
AllowOverride None
Order allow, refuse
allow everyone


ScriptAlias ​​/ cgi-bin / / usr / lib / cgi-bin /

    AllowOverride None
Options + ExecCGI -MultiViews + SymLinksIfOwnerMatch
Order allow, refuse
Allow everyone


ErrorLog /var/log/apache2/error.log

# Possible values ​​include: debug, info, notice, warn, error, crit,
# alert, emerging.
LogLevel warn

Combined CustomLog /var/log/apache2/access.log

Alias ​​/ doc / "/ usr / share / doc /"

    Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny, allow
Refuse everyone
Allow from 127.0.0.0/255.0.0.0 :: 1/128



I added the following to / etc / hosts:

127.0.0.1 www.my-site.com

I've also run the following command in / etc / apache2 / sites-enabled:

ln -sf /etc/apache2/sites-available/my-site.com /etc/apache2/sites-enabled/my-site.com

The problem is that when I go in my browser for mon-site.comI am redirected to the old site I had on localhost before. My old site does not allow a user to go anywhere until he has logged in, and it seems like I am routinely redirected to the login page.

How to access my new site and create an environment in which I can work on these two projects?

Let me know if I need to provide more information.

Thank you!

apache2 – Can not Install Apache 2 on Ubuntu 16.04

I have tried to install apache2 on Ubuntu 16.04 lts in:

sudo apt-get install apache2 -y

And the exit says:

Reading package lists ... Done
Build a dependency tree
Reading status information ... Done
The following additional packages will be installed:
apache2-data apache2-utils
Suggested packages:
apache2-doc apache2-suexec-primitive | apache2-suexec-custom
The following new packages will be installed:
apache2 apache2-data apache2-utils
0 upgraded, 3 newly installed, 0 to remove and 1 not upgraded.
Need to get 330 kB of archives.
After this operation, 1718 KB of additional disk space will be used.
Get: 1 http://archive.ubuntu.com/ubuntu xenial-updates / main amd64 apache2-utils amd64 2.4.18-2ubuntu3.9 [81.8 kB]
Get: 2 http://archive.ubuntu.com/ubuntu xenial-updates / main amd64 apache2-data all 2.4.18-2ubuntu3.9 [162 kB]
Get: 3 http://archive.ubuntu.com/ubuntu xenial-updates / main amd64 apache2 amd64 2.4.18-2ubuntu3.9 [86.6 kB]
Recovered 330 KB in 0s (439 KB)
Selection of the previously unselected apache2-utils package.
(Reading the database ... 470444 files and directories currently installed.)
Preparing to decompress ... / apache2-utils_2.4.18-2ubuntu3.9_amd64.deb ...
Unpack apache2-utils (2.4.18-2ubuntu3.9) ...
Selection of the previously unselected apache2-data package.
Preparing to decompress ... / apache2-data_2.4.18-2ubuntu3.9_all.deb ...
Unpack apache2-data (2.4.18-2ubuntu3.9) ...
Previously unselected package selection apache2.
Preparing for decompression ... / apache2_2.4.18-2ubuntu3.9_amd64.deb ...
Unpack apache2 (2.4.18-2ubuntu3.9) ...
Trigger processing for man-db (2.7.5-1) ...
Trigger processing for systemd (229-4ubuntu21.16) ...
Trigger processing for ureadahead (0.100.0-19) ...
Trigger processing for ufw (0.35-0ubuntu2) ...
Updated Rules for the 'Full Apache' Profile & # 39;
Updated rules for the profile & # 39; OpenSSH & # 39;
Reloaded firewall
Configuration of apache2-utils (2.4.18-2ubuntu3.9) ...
Configure apache2-data (2.4.18-2ubuntu3.9) ...
Setting up of apache2 (2.4.18-2ubuntu3.9) ...
The apache2.service job failed because the checkout process ended with an error code. See "systemctl status apache2.service" and "journalctl -xe" for more details.
invoke-rc.d: initscript apache2, the action "start" failed.
● apache2.service - LSB: Apache2 Web Server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
Acheapache2-systemd.conf
Active: failed (result: exit code) since Sat 2019-03-02 18:07:41 CET; 5ms ago
Docs: man: systemd-sysv-generator (8)
Process: 17497 ExecStart = /etc/init.d/apache2 start (code = left, status = 1 / FAILURE)

02 Mar 18:07:41 gervis apache2[17497]: *
02 Mar 18:07:41 gervis apache2[17497]: * Configtest apache2 failed.
02 Mar 18:07:41 gervis apache2[17497]: The result of the configuration test was:
02 Mar 18:07:41 gervis apache2[17497]: apache2: Syntax error at line 219 of ... d.
02 Mar 18:07:41 gervis apache2[17497]: The action 'configtest & # 39; has failed.
02 Mar 18:07:41 gervis apache2[17497]: The Apache error log may have more than i ... n.
02 Mar 18:07:41 gervis systemd[1]: apache2.service: The check process has been exited, ... = 1
02 Mar 18:07:41 gervis systemd[1]: Can not start LSB: Apache2 Web server.
02 Mar 18:07:41 gervis systemd[1]: apache2.service: the unit has entered failure state.
02 Mar 18:07:41 gervis systemd[1]: apache2.service: Result failed "exi ..."
Tip: Some lines were ellipsized, use -l to display them in full.

Line 219 of /etc/apache2/apache2.conf is as below

enter the description of the image here

And I do not know how to use this information:

Some lines have been ellipsed, use -l to display the entirety.

Any help on this topic will be appreciated.

tls – Oracle OpenSSL Padding. The specific ciphers on apache2 seem a bit limited

I have read many articles that officially explain how to prevent OpenSSL Padding Oracles. They usually indicate that its CBC encryption suites leave you vulnerable.

The following list works for me and allows me to get an A on SSLLabs.

SSLProtocol -all + TLSv1.2
SSLHonorCipherOrder On
SSLCipherSuite ECDH + AESGCM: DH + AESGCM: RSA + AESGCM :! Anüll :! MD5 :! DSS :! DOW :! MEDIUM

My problem is that I can not add any more without getting an F and being open to the Oracle Padding in question.

If I then compare that to the results of a security website, such as http://binance.com. They receive A + AND they have CBC figures present.

My question then, how can I protect myself against Oracle OpenSSL Padding (CVE-2016-2107), while allowing more ciphers? Is there more configuration I can do elsewhere to protect, while allowing a wider range of ciphers (LOW or not)? I also see that TLSv1.0 and TLSv1.1 can also be enabled with a limited number of ciphers. ****

My reasoning is that my current list prevents Safari 6-8, Android 2-4 and Windows 7 IE 8-10. I would like to open this.

Thank you

apache2 – Do not allow access to example.com/image/pic.jpg using htaccess

I have two domains for the same site.
example.com and example2.com.

I do not want the /image/pic.jpg be accessible for the example.com
It means that if someone tries to visit exemple.com/image/pic.jpg it will show him an error. But I want it to be accessible for example2.com visitors. So if someone visiting example2.com/image/pic.jpg they will be able to see the picture

How can I do this using htaccess?