6RUN0

Пример установки drupal7 в ubuntu

Feb 23rd, 2012
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 11.18 KB | None | 0 0
  1. boris@boris-pc:~$ mkdir -p /home/www/drupal7.dev/logs/
  2. boris@boris-pc:~$ mkdir -p /home/www/drupal7.dev/public_html/
  3. boris@boris-pc:~$ wget -c http://ftp.drupal.org/files/projects/drupal-7.12.tar.gz
  4. boris@boris-pc:~$ tar -xzf drupal-7.12.tar.gz
  5. boris@boris-pc:~$ mv -T drupal-7.12 /home/www/drupal7.dev/public_html/
  6. boris@boris-pc:~$ sudo su
  7. [sudo] password for boris:
  8. root@boris-pc:/home/boris# echo '127.0.0.1      www.drupal7.dev drupal7.dev' >> /etc/hosts
  9. root@boris-pc:/home/boris# exit
  10. exit
  11. boris@boris-pc:~$ ping www.drupal7.dev
  12. PING www.drupal7.dev (127.0.0.1) 56(84) bytes of data.
  13. 64 bytes from www.drupal7.dev (127.0.0.1): icmp_req=1 ttl=64 time=0.029 ms
  14. 64 bytes from www.drupal7.dev (127.0.0.1): icmp_req=2 ttl=64 time=0.025 ms
  15. 64 bytes from www.drupal7.dev (127.0.0.1): icmp_req=3 ttl=64 time=0.026 ms
  16. 64 bytes from www.drupal7.dev (127.0.0.1): icmp_req=4 ttl=64 time=0.026 ms
  17. ^C
  18. --- www.drupal7.dev ping statistics ---
  19. 4 packets transmitted, 4 received, 0% packet loss, time 2997ms
  20. rtt min/avg/max/mdev = 0.025/0.026/0.029/0.005 ms
  21. boris@boris-pc:~$ cd /etc/apache2/sites-available/
  22. boris@boris-pc:/etc/apache2/sites-available$ vim drupal7.dev
  23. ...
  24. boris@boris-pc:/etc/apache2/sites-available$ cat drupal7.dev
  25. # $Id: drupal7.dev,v 1.1 2012/02/23 12:14:18 root Exp $
  26. <VirtualHost 127.0.0.1:80>
  27.   ServerName drupal7.dev
  28.   ServerAlias www.drupal7.dev
  29.   #ServerAdmin webmaster@localhost
  30.   DocumentRoot "/home/www/drupal7.dev/public_html"
  31.   <Directory "/home/www/drupal7.dev/public_html">
  32.     Options None
  33.     AllowOverride All
  34.     Order allow,deny
  35.     Allow from all
  36.   </Directory>
  37.   ErrorLog "|/usr/sbin/rotatelogs -l /home/www/drupal7.dev/logs/errorlog-%Y.%m.%d 86400"
  38.   CustomLog "|/usr/sbin/rotatelogs -l /home/www/drupal7.dev/logs/accesslog-%Y.%m.%d 86400" common
  39. </VirtualHost>
  40. boris@boris-pc:/etc/apache2/sites-available$ cat ../ports.conf
  41. # $Id: ports.conf,v 1.2 2012/01/21 09:04:44 root Exp $
  42. # If you just change the port or add more ports here, you will likely also
  43. # have to change the VirtualHost statement in
  44. # /etc/apache2/sites-enabled/000-default
  45. # This is also true if you have upgraded from before 2.2.9-3 (i.e. from
  46. # Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
  47. # README.Debian.gz
  48. /home/www/drupal7.dev/public_html/sites/default/default.settings.php
  49. NameVirtualHost 127.0.0.1:80
  50. Listen 127.0.0.1:80
  51.  
  52. <IfModule mod_ssl.c>
  53.     # If you add NameVirtualHost *:443 here, you will also have to change
  54.     # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
  55.     # to <VirtualHost *:443>
  56.     # Server Name Indication for SSL named virtual hosts is currently not
  57.     # supported by MSIE on Windows XP.
  58.     Listen 127.0.0.1:443
  59. </IfModule>
  60.  
  61. <IfModule mod_gnutls.c>
  62.     Listen 127.0.0.1:443
  63. </IfModule>
  64. boris@boris-pc:/etc/apache2/sites-available$ cat ../conf.d/security
  65. # $Id: security,v 1.2 2012/01/21 08:56:54 root Exp $
  66. #
  67. # Disable access to the entire file system except for the directories that
  68. # are explicitly allowed later.
  69. #
  70. # This currently breaks the configurations that come with some web application
  71. # Debian packages.
  72. #
  73. <Directory />
  74.   Options None
  75.   AllowOverride None
  76.   Order Deny,Allow
  77.   Deny from all
  78. </Directory>
  79.  
  80.  
  81. # Changing the following options will not really affect the security of the
  82. # server, but might make attacks slightly more difficult in some cases.
  83.  
  84. #
  85. # ServerTokens
  86. # This directive configures what you return as the Server HTTP response
  87. # Header. The default is 'Full' which sends information about the OS-Type
  88. # and compiled in modules.
  89. # Set to one of:  Full | OS | Minimal | Minor | Major | Prod
  90. # where Full conveys the most information, and Prod the least.
  91. #
  92. #ServerTokens Minimal
  93. #ServerTokens OS
  94. #ServerTokens Full
  95. ServerTokens Prod
  96.  
  97. #
  98. # Optionally add a line containing the server version and virtual host
  99. # name to server-generated pages (internal error documents, FTP directory
  100. # listings, mod_status and mod_info output etc., but not CGI generated
  101. # documents or custom error documents).
  102. # Set to "EMail" to also include a mailto: link to the ServerAdmin.
  103. # Set to one of:  On | Off | EMail
  104. #
  105. ServerSignature Off
  106.  
  107. #
  108. # Allow TRACE method
  109. #
  110. # Set to "extended" to also reflect the request body (only for testing and
  111. # diagnostic purposes).
  112. #
  113. # Set to one of:  On | Off | extended
  114. #
  115. TraceEnable Off
  116. #TraceEnable On
  117.  
  118. boris@boris-pc:/etc/apache2/sites-available$ sudo a2ensite drupal7.dev
  119. Enabling site drupal7.dev.
  120. To activate the new configuration, you need to run:
  121.   service apache2 reload
  122. boris@boris-pc:/etc/apache2/sites-available$ sudo service apache2 reload
  123.  * Reloading web server config apache2
  124. boris@boris-pc:/etc$ mysql -u root -p
  125. Enter password:
  126. Welcome to the MariaDB monitor.  Commands end with ; or \g.
  127. Your MariaDB connection id is 7
  128. Server version: 5.2.10-MariaDB-mariadb107~oneiric-log (MariaDB - http://mariadb.com/)
  129.  
  130. This software comes with ABSOLUTELY NO WARRANTY. This is free software,
  131. and you are welcome to modify and redistribute it under the GPL v2 license
  132.  
  133. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  134.  
  135. MariaDB [(none)]> CREATE DATABASE drupal7_dev;
  136. Query OK, 1 row affected (0.05 sec)
  137.  
  138. MariaDB [(none)]> USE mysql;
  139. Reading table information for completion of table and column names
  140. You can turn off this feature to get a quicker startup with -A
  141.  
  142. Database changed
  143. MariaDB [mysql]> GRANT ALL PRIVILEGES ON drupal7_dev.* TO drupal7_dev@localhost IDENTIFIED BY 'V!J0"84SA4+##xP!';
  144. Query OK, 0 rows affected (0.06 sec)
  145.  
  146. MariaDB [mysql]> \q
  147. Bye
  148. boris@boris-pc:/etc$ cp /home/www/drupal7.dev/public_html/sites/default/default.settings.php /home/www/drupal7.dev/public_html/sites/default/settings.php  
  149. boris@boris-pc:/etc$ chmod a+w /home/www/drupal7.dev/public_html/sites/default/settings.php
  150. boris@boris-pc:/etc$ mkdir /home/www/drupal7.dev/public_html/sites/default/files
  151. boris@boris-pc:/etc$ chmod a+rwX /home/www/drupal7.dev/public_html/sites/default/files
  152. ...
  153. boris@boris-pc:~$ cat /home/www/drupal7.dev/public_html/.htaccess
  154. #
  155. # Apache/PHP/Drupal settings:
  156. #
  157.  
  158. # Protect files and directories from prying eyes.
  159. <FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$">
  160.   Order allow,deny
  161. </FilesMatch>
  162.  
  163. # Don't show directory listings for URLs which map to a directory.
  164. Options -Indexes
  165.  
  166. # Follow symbolic links in this directory.
  167. Options +FollowSymLinks
  168.  
  169. # Make Drupal handle any 404 errors.
  170. ErrorDocument 404 /index.php
  171.  
  172. # Set the default handler.
  173. DirectoryIndex index.php index.html index.htm
  174.  
  175. # Override PHP settings that cannot be changed at runtime. See
  176. # sites/default/default.settings.php and drupal_initialize_variables() in
  177. # includes/bootstrap.inc for settings that can be changed at runtime.
  178.  
  179. # PHP 5, Apache 1 and 2.
  180. <IfModule mod_php5.c>
  181.   php_flag magic_quotes_gpc                 off
  182.   php_flag magic_quotes_sybase              off
  183.   php_flag register_globals                 off
  184.   php_flag session.auto_start               off
  185.   php_value mbstring.http_input             pass
  186.   php_value mbstring.http_output            pass
  187.   php_flag mbstring.encoding_translation    off
  188. </IfModule>
  189.  
  190. # Requires mod_expires to be enabled.
  191. <IfModule mod_expires.c>
  192.   # Enable expirations.
  193.   ExpiresActive On
  194.  
  195.   # Cache all files for 2 weeks after access (A).
  196.   ExpiresDefault A1209600
  197.  
  198.   <FilesMatch \.php$>
  199.     # Do not allow PHP scripts to be cached unless they explicitly send cache
  200.     # headers themselves. Otherwise all scripts would have to overwrite the
  201.     # headers set by mod_expires if they want another caching behavior. This may
  202.     # fail if an error occurs early in the bootstrap process, and it may cause
  203.     # problems if a non-Drupal PHP file is installed in a subdirectory.
  204.     ExpiresActive Off
  205.   </FilesMatch>
  206. </IfModule>
  207.  
  208. # Various rewrite rules.
  209. <IfModule mod_rewrite.c>
  210.   RewriteEngine on
  211.  
  212.   # Block access to "hidden" directories whose names begin with a period. This
  213.   # includes directories used by version control systems such as Subversion or
  214.   # Git to store control files. Files whose names begin with a period, as well
  215.   # as the control files used by CVS, are protected by the FilesMatch directive
  216.   # above.
  217.   #
  218.   # NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
  219.   # not possible to block access to entire directories from .htaccess, because
  220.   # <DirectoryMatch> is not allowed here.
  221.   #
  222.   # If you do not have mod_rewrite installed, you should remove these
  223.   # directories from your webroot or otherwise protect them from being
  224.   # downloaded.
  225.   RewriteRule "(^|/)\." - [F]
  226.  
  227.   # If your site can be accessed both with and without the 'www.' prefix, you
  228.   # can use one of the following settings to redirect users to your preferred
  229.   # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  230.   #
  231.   # To redirect all users to access the site WITH the 'www.' prefix,
  232.   # (http://example.com/... will be redirected to http://www.example.com/...)
  233.   # uncomment the following:
  234.   # RewriteCond %{HTTP_HOST} !^www\. [NC]
  235.   # RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  236.   #
  237.   # To redirect all users to access the site WITHOUT the 'www.' prefix,
  238.   # (http://www.example.com/... will be redirected to http://example.com/...)
  239.   # uncomment the following:
  240.   # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  241.   # RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
  242.  
  243.   # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  244.   # VirtualDocumentRoot and the rewrite rules are not working properly.
  245.   # For example if your site is at http://example.com/drupal uncomment and
  246.   # modify the following line:
  247.   # RewriteBase /drupal
  248.   #
  249.   # If your site is running in a VirtualDocumentRoot at http://example.com/,
  250.   # uncomment the following line:
  251.   # RewriteBase /
  252.  
  253.   # Pass all requests not referring directly to files in the filesystem to
  254.   # index.php. Clean URLs are handled in drupal_environment_initialize().
  255.   RewriteCond %{REQUEST_FILENAME} !-f
  256.   RewriteCond %{REQUEST_FILENAME} !-d
  257.   RewriteCond %{REQUEST_URI} !=/favicon.ico
  258.   RewriteRule ^ index.php [L]
  259.  
  260.   # Rules to correctly serve gzip compressed CSS and JS files.
  261.   # Requires both mod_rewrite and mod_headers to be enabled.
  262.   <IfModule mod_headers.c>
  263.     # Serve gzip compressed CSS files if they exist and the client accepts gzip.
  264.     RewriteCond %{HTTP:Accept-encoding} gzip
  265.     RewriteCond %{REQUEST_FILENAME}\.gz -s
  266.     RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
  267.  
  268.     # Serve gzip compressed JS files if they exist and the client accepts gzip.
  269.     RewriteCond %{HTTP:Accept-encoding} gzip
  270.     RewriteCond %{REQUEST_FILENAME}\.gz -s
  271.     RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
  272.  
  273.     # Serve correct content types, and prevent mod_deflate double gzip.
  274.     RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
  275.     RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
  276.  
  277.     <FilesMatch "(\.js\.gz|\.css\.gz)$">
  278.       # Serve correct encoding type.
  279.       Header set Content-Encoding gzip
  280.       # Force proxies to cache gzipped & non-gzipped css/js files separately.
  281.       Header append Vary Accept-Encoding
  282.     </FilesMatch>
  283.   </IfModule>
  284. </IfModule>
Advertisement
Add Comment
Please, Sign In to add comment