V
V
Viktor Yanyshev2017-03-06 09:23:52
Apache HTTP Server
Viktor Yanyshev, 2017-03-06 09:23:52

How to properly set the rights?

How to properly set permissions for Apache2 to work properly on ubuntu?
All projects are in /home/yanyshev/project, previously cms MODX was installed in this directory without problems and continue to work. Also various small self-made bicycle projects in php that also work fine, directories, files; edited, deleted, read.
But recently (somewhere that I changed and didn’t notice, apparently) problems began to arise with the installation of MODX (began to report that there were not enough rights to execute PHP), everything was solved 777 (then uploading to a combat server with normal rights). Here recently, I decided to get acquainted with yii2. The problem was not long in coming, I already raised this pig .
Apache config is now:

# Global configuration
#ServerRoot "/etc/apache2"

Mutex file:${APACHE_LOCK_DIR} default

PidFile ${APACHE_PID_FILE}

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 5

# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

HostnameLookups On

ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf

<Directory />
  Options FollowSymLinks
  AllowOverride None
  Require all denied
</Directory>

<Directory /usr/share>
  AllowOverride None
  Require all granted
</Directory>

<Directory /home/yanyshev/project>
  Options Indexes FollowSymLinks
  AllowOverride None
  Require all granted
</Directory>

AccessFileName .htaccess

<FilesMatch "^\.ht">
  Require all denied
</FilesMatch>

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-03-06
@slo_nik

Good morning.
For yii2:
1) runtime and web/assets - 777
2) At runtime for all directories, the owner is www-data and 775
If you generate a model or class or view through gii, then the rights are 777 to the directory in which you need to generate the file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question