What is LAMP? Advantages and shortcomings. Special images of Dark VDS for swedish slicing of LAMP servers Mutualization of MVC elements

Golovna / Google Play

Under the stack of web-additions, we can use anonymous software products with open code: operating system, web-server, database server and the middle of the generated code. The largest and most famous stack is LAMP. This is an acronym for a stack of web add-ons based on cost-free solutions with a valid code.

LAMP- an acronym, which means a set (complex) of server software, which is widely recognized by the All-World's Web. LAMP of names after the first letters of the components that enter before this warehouse:

    L inux operating system Linux;

    A pache-Web server;

    M ariaDB/ M ySQL-DBMS;

    P HP-movie programming, which is used to create web add-ons (PHP can be used in other languages, as well as Perl and Python).

The LAMP acronym can be tagged for reference:

    web server infrastructure

    programming paradigms

    Software package

I want to start chi software products not razroblyalis specifically for work one by one, such a connection has become more popular due to its flexibility, productivity and low varity (all warehouses and warehouses are open and can be cost-free zavantagenі z Іnternet). Gathering LAMP enters the warehouse of most Linux distributions and hopes for rich sting companies.

Linux takes care of the reception/transmission of requests (controls the input) and is the core for everything else - the server, the DBMS, the movie support.

Installation on Ubuntu

You need to install the following packages:

After running the apt-get update command to update the local list of packages, you can install these packages with the help of one apt-get install command:

After the last command, you will be asked to install ts packages and other deposits. Type "y" and then the Enter key to continue and access other entries to set the administrative password for MySQL.

To allow you to set the minimum set of PHP extensions required for PHP whistleblower from MySQL.

Features and benefits of OS Linux

Bezshtovnіst.

Hopefulness. The correct operation of the hardware of your PC, allow Linux'u pratsyuvati rocky without reloading that freeze. And the Reset button is not needed at all.

Bezpeka. Linux has virtually no viruses. The operating system itself will turn off the operation of the shkidlivih programs.

Open code. Tse give the opportunity to win and modify the code for your own needs.

The main advantages of Apache are superiority and flexible configuration. Vіn allows you to connect external modules for nadanny data, vicory DBMS for authentication koristuvachіv, modifikuvati podomlennya about pardons toshcho.

Hnuchkist DBMS MySQL be sure to support a large number of table types MyISAM, scho to support full text search, so tables InnoDB, yakі pіdtrimuyut transactions only on par іnі okremіh records. On top of that, the MySQL DBMS comes with a special EXAMPLE table type that demonstrates the principles of creating new table types. Zavdyaki arkhitektury that GPL-licensing, in the MySQL DBMS, new table types are being added.

PHP - script language wild recognition, which is intensively promoted for the development of web add-ons. At this hour, it is supported by the most important hosting providers and є one of the leaders of the middle language dynamic websites .

Under the stack of web-additions, we can use anonymous software products with open code: operating system, web-server, database server and the middle of the generated code. The largest and most famous stack is LAMP. This is an acronym for a stack of web add-ons based on cost-free solutions with a valid code.

LAMP- an acronym that designates a set (complex) of server software, which is widely recognized by the All-World's Web. LAMP of names after the first letters of the components that enter before this warehouse:

· L inux - operating Linux system

;

· A pache- Web server;

· M ariaDB / M ySQL - DBMS;

· P HP is a language programming tool that is used to create web add-ons (PHP can be used in other languages, such as Perl and Python).

The LAMP acronym can be tagged for reference:

1. Web server infrastructure

2. Programming paradigms

3. Software package

While a bunch of software products were not distributed specifically for work one by one, such a connection became even more popular due to its flexibility, productivity and low variance (all warehouses and warehouses can be easily downloaded from the Internet). Gathering LAMP to enter the warehouse of large Linux distributions and hopes to be rich by hosting companies.

Linux takes care of the reception/transmission of requests (controls the input) and is the core for everything else - the server, the DBMS, the movie support.

Installation on Ubuntu

You need to install the following packages:

After running the apt-get update command to update the local list of packages, you can install these packages with the help of one apt-get install command:

After the last command, you will be asked to install ts packages and other deposits. Type "y" and then the Enter key to continue and access other entries to set the administrative password for MySQL.

To allow you to set the minimum PHP extension set, the required PHP version of MySQL.



Features and benefits of OS Linux

Bezshtovnіst.

Hopefulness. Correct robot hardware part of your PC, let Linux'u pratsyuvati rocky without re-engineering that freeze. And the Reset button is not needed at all.

Bezpeka. Linux has virtually no viruses. The operating system itself will turn off the operation of the shkidlivih programs.

Open code. Tse give the opportunity to win and modify the code for your own needs.

The main advantages of Apache are superiority and flexible configuration. Vіn allows you to connect external modules for nadanny data, vicory DBMS for authentication koristuvachіv, modifikuvati podomlennya about pardons toshcho.

The flexibility of the MySQL DBMS is supported by a large number of table types: MyISAM, scho to support full text search, so tables InnoDB, yakі pіdtrimuyut transactions only on par іnі okremіh records. On top of that, the MySQL DBMS comes with a special EXAMPLE table type that demonstrates the principles of creating new table types. Zavdyaki arkhitektury that GPL-licensing, in the MySQL DBMS, new table types are being added.

php- script language wild recognition, which is intensively promoted for the development of web add-ons. At this hour, it is supported by the most important hosting providers and є one of the leaders of the middle language dynamic websites .

3. Web supplement. Model-View-Controller design template.

Design Pattern - an architectural design, which is the solution to the problem of design within the context. Traditionally, in OOP, you show the differences between classes and objects, without specifying which classes and objects the program will use.

Model-View-Controller. The MVC design template transfers these programs, the core interface, and the underlying logic into three four components: Model, File, and Controller - so that modification of the skin component can be applied independently. First of all, this is a template for blocking the framework, which is being developed for the Smalltalk movie, like the 1970s. From this point in time, the main role is played by the majority of frameworks with the interface of the koristuvach. Vіn dokorіnno having changed the look at the design of addenda.

Model - tse vіdobrazhennya dіysnostі, scho vrakhovuє nebhіdnі for vyvіshennya put ї zadachі yakostі. The model includes the logic of solving the main task (business logic):

● saving, remote, updating of these programs (CRUD or other web services);

●encapsulation of all program logic (it is necessary to unify "their" controllers, so that part of the business logic cannot be transferred to the controller or the appearance).

CRUD - Create, Read, Update, Delete.

The model defines and manages data and is often referred to as the business logic of an application program as well. її heart. Submission Describe those things that can be done and with which wines can be combined in application programs. Controller Serve as an intermediary between models and submissions.
The main mechanism for implementing the View-part of the template (but not the same!) is the Template Engine.

Interaction of MVC elements

The skin element of the MVC template is linked to other specific methods. Communications are implemented following a sequence of steps, as they are launched in conjunction with the program. The sequence of steps looks like this:

  1. Koristuvach interfacing with the interface element (for example, pressing the button in the submission).
  2. Giving strength to the onslaught of the Controller, sob virishit, as the onslaught of work.
  3. The controller changes the model based on how the button is pressed.
  4. Model informs Notification that the country of the Model has changed.
  5. Podannya read information about the camp at the Model and independently change.

4. Web add-on. Templateizer.

Template engine (on the web) - ce software security allows you to create html templates for generating end html pages. The main meta templating templating engine is the core representation of data in the generated code. Often it is necessary for the security of the parallel work of the programmer and the layout designer. Using templates often improves the readability of the code and changes made to old look, if the project is completed by one person.

Victims template engines are often distinguished from the MVC paradigm. Qi understanding pov'yazanі, ale z totozhnі.

The essence of templating is to create a frame of the side in the program code. The frame of the side is placed in an okremy text file (template), in areas where it is necessary to enter data, special pseudo-changes are placed. The script captures the required template, replaces the new pseudo-changes with the required data and displays it.

Considerations for giving different templates when generating HTML side code:

· First of all, the purity of the code. The program code does not interfere with HTML code, it is easy to read. At the same time, the template can only be replaced by an HTML code, in which it is visible to insert data (for which let's understand the names of pseudo-changes).

· In a different way, podіl software and HTML-code gives the possibility of independent development of the engine and design. In order to change the existing site, it is enough to make changes to a suitable template, while not requiring programming skills.

· The site may be the mother of a kіlka designіv. To change the design of the site again, simply change the path to the folder with templates.

Advantages:

· Povne podіl vyvedennya vіd logics dodatka;

· The mode "pisochnitsі";

· accurate zovnіshnіy look of blocks of logic or operators of vision;

· Transferring between platforms (movies) - tobto. template parser can be written in whatever;

· Mova to a template ozumіla "verstalnik";

About advances

Looking at the nutrition under the logic of the program in the visnovka, we can say that the incorporation of the logic in the visnovka is stagnant in the development web-additives in their main mass only when using the MVC pattern. Marvel at yourself, so and є all apply the most common usage of templates and logics are shown in the context MVC.

You can’t help but wait, that it’s smart to manually tweak the design of the internal isolated logic to the template independently from the platform ( php, ROR, java), so that you will analyze these templates and fill them with data, bring up the koristuvachev. In addition, it guarantees that the retailers will not cheat in the templates the logic of the program or the SQL query.

The "sandbox" mode is even more advanced, if it is necessary to give it to the text editor, the template editor, and the possibility of syntax. For example, it is relevant for the service of blogs, the decoration of independently arranging the materials of vicorist, html-layout and specific design of the vicorist service.

5. Web supplement. Relational databases

The relational data base is a collection of interdependent tables, skin for storing information about objects of the same type. A row of tables contains data about one object (for example, a product, a client), and the columns of the tables describe different characteristics tsikh ob'єktіv – attributіv (for example, naming, product code, vіdomostі pro klієnta). Entries, like rows of tables, have the same structure - stinks are added up from the fields, which take the attributes of the object. The skin field, tobto stovpets, signifies only one characteristic of the object and may sing the type of data. Usі records mayut one and the same fields, they are less likely to have different informational powers of the object.

In the relational data base, the skin table is responsible for the mother's primary key - the field or the combination of fields, which identifies the skin row of the table. As the key is folded from a number of fields, wines are called warehousing. The key may be unique and uniquely signify the record. A single entry can be known behind the key values. Keys also serve to order information in the database.

Relational database tables may be able to support the normalization of data. Normalization of vіdnosin - tse formal device obmezhennja molding table, which allows you to use the duplication, ensure the lack of superficiality like in the data base, change the labor and expenditure of the data base.

Let's create a table Student, to fill in the following fields: group number, PIB, filling number, date of birth, name of the specialty, name of the faculty. Such an organization of the collection of information is low inconsistencies:

· duplication of information (the name of the specialty and faculty is repeated for the skin student), then, the database will be increased;

· The procedure for updating the information in the tables is important due to the need to edit the skin record of the tables.

Normalization of the tables is recognized for the adoption of these nedolіkіv. Є three normal forms.

Persha is the normal form. The relational table is given to the first normal form, and only once, if one of the rows does not have more than one value in its field and the same key fields are not empty. So, just like in the tables, the Student needs to take the vіdomosti on the student's name, then the PІB sled split into parts Prіzvische, Іm'ya, By the father.

Another normal form. The relational table is defined in another normal form, as it is more than happy with the first normal form, and all fields that do not enter before the primary key are associated with the same functional fallacy with the primary key. In order to bring the table to another normal form, it is necessary to determine the functional fallow of fields. Functional staleness watering - tse fallow, if in an instance of an informational object the key value of the key requisite is given only one value of the description requisite.

The third is normal form. The table is located in the third normal form, although it is more than satisfied with the other normal form, even with її non-key fields it is not possible to fall functionally in any other non-key field. For example, the Student table (Group No., PIB, Book No., Date of birth, Starosta) has three fields - No. No. of the group should be deposited in the number of the booklet, and the Starosta should be deposited in the number of the group. For the adoption of transitive fallow, it is necessary to transfer part of the fields of the Student tables to the other table of the Group. The tables are coming soon: Student (group number, ПІБ, credit card number, date of birth), Group (group number, Starosta).

The following operations can be performed on relational tables:

· Consolidated tables with the same structure. The result is a big table: first, first, then a friend (concatenation).

· Retin table with the same structure. Result - those records are selected, as in both tables.

· View tables with the same structure. The result - vibirayutsya those records, which are not visible.

· Vibіrka (horizontal p_dmnozhina). The result is that records are selected that resonate with the singing minds.

· Projection (vertical submultiple). The result is a reminder that a part of the watering from the weekend tables should be avenged.

· Cartesian twir two tables Records of the resulting table look like a combination of the skin record of the first table with the skin record of the next table.

Relational tables can be tied to each other, and data can be tied together at the same time from a number of tables. The tables are linked to each other in order to allow changing the database. The links of the skin wager are safe for the presence of the same stovptsіv in them.

Use this type informational contacts:

one to one

One-to-the-bagatiom;

· Bagato hto to bagatioh.

Web supplement. NoSQL.

One of the meanings of the term "NoSQL" is the difference between the relational model and the complexity of specific (or more sophisticated) data models. For example, traditionally successful NoSQL systems are systems for storing key-value pairs, such as Redis or Memcache. This model of data is extremely simple - it is essentially an associative array, de keys can be a row type, and values ​​can be replaced by data. As if it were an associative array, such systems support typing operations on data - read the key value, insert the key value, view the key and assign a value to it. The “remove list of keys” operation may not be supported on such systems.

The second example of successful NoSQL systems is document collections. Objects in such collections should be called associative arrays of a free structure, so that in the same table, differences can be saved according to the essence of the object. Apply systems of this class - MongoDB and Cassandra. Fallow in the first place, as in reality, data are taken from a specific basis, and productivity can vary greatly. For example, to optimize such a “table”, taking from it objects of the same type.

The third example of specialized NoSQL systems is graph databases. The stench is imprisoned by a special rank for processing a specific structure of data, and for work with a great obligation of data (because on small obligations, a standard relational implementation can miraculously turn up).

Another important butt of NoSQL systems file systems, such as Ext4 or NTFS. The stench is recognized for the selection of objects as a hierarchical structure instead of a free format. The data bases themselves, the NoSQL relational ones, are victorious for choosing your own file system, and other interactions between these two subsystems become important for someone else.

7. Web supplement. Mobility of JavaScript.

JavaScript is my programming, which is interpreted with object-oriented capabilities.

Possibilities

The output code can be run not only in the browser, but also on the server side or command line Let's take a look at JavaScript for web pages. Modern JavaScript - tse "safe" mova zagaluvannya confession. Vіn do not give low performance to work with memory, processor, scaling back and forth on browsers, in which case it is not necessary.

As far as other possibilities - the stench of being stale, for example, running JavaScript. The JavaScript browser is capable of working with everything that needs to be manipulated by the side, interacting with the view and, like the world, with the server:

Add different animation effects

React on the bottom - process the movement of the mouse, pressing the keys from the keyboard

· Recheck the input of data in the form field before editing it to the server, so that you have to take additional input from the server

· Create and read cookies, read data about the computer

· Choose the browser and the default browser type - change I will need a side specially recognized for which browser

Change in place of HTML elements, add new tags, change styles

Exchange

· JavaScript can't close the window of that tab, because it won't help you

· You can't protect the external code of the side and copy the text or the image from the side

· Cannot enable cross-domain requests, restrict access to web sites that are distributed on a different domain. Navit if sides from different domains are displayed at the same time in different tabs of the browser, then JavaScript code What to belong to one domain does not allow access to information about the web site from another domain. This guarantees the security of private information, as it may be known to the domain’s keeper

· Do not have access to files, roztashovanih on the computer of the koristuvach, that access outside the web site itself, the only blame cookies, but small text files, such as JavaScript can be written and read.

In general, we can say that the wines are broken up in such a way that it would be more difficult to break the code.

8. Web supplement. Vikonanny middle. The web server is installed and configured.

Apache server is a cross-platform web server, the most widely used today, because installations on more hostings and more simple in the installation of lower, for example, web server nginx.

So the apache server itself is supplied in such collections as denwer and xampp, so php apache is even a popular collection. Installing apache windows, linux below for messages:

· Installed apache linux

· Installing apache windows

Yak practice Apache server:

Receive requests cyclically

· Make a request

· Generating content

· Viddaє koristuvachevі content

Apache web has a mechanism of virtual hosts, for the help of which it is possible to split a domain name into a single IP address. To skin domain name you can fix your own custom, apache carried out at the .htaccess file, which should be added to the root directory of your site.

Apache port, which wins for locking, 80. You can fix problems with some programs, use skype. To solve the problem, it is necessary to disable port 80 in skype. If you win apache port 80 jobs, then you can change the value on the web server.

On the apache site great kіlkistyu statics (image) work more, lower site on nginx. Sometimes you can see such a link like apache server + nginx, nginx hacks for displaying statics.

To program in PHP you need to install the following components:

· apache or another web server;

· MySQL (+ phpmyadmin for MySQL robots via web-interface).

Є two options for installing these components:

· Installing a ready-made package (xampp, denwer, etc.)

· Installation of all packages

Everything is simple for the first person, just grab the package and install it. Ale, with manual installation, there is nothing to fix problems from updated versions, because. you already know how it works and how it is being restored. There is also less chance that you will have problems with packages.

Manually installed:

· Download and install apache on sent

· Download and install mysql by have a link

how you can install an add-on phpmyadmin for robots with mysql via web-interface

After installation, like and after making any changes, it is necessary to re-advance apache. Go to "Start - Napel Management - Administration - Services" and we know Apache there, press the right button in context menu choose to re-vantagize.

To work, you need to add a virtual host, so you can read here.

Seredovishche Vikonanny

The eTBManager program is the JBOSS server program, which works with data, which is under the database server's password danih MySQL. Koristuvachі work with the program from the Internet browser (IE, FireFox, Crhome, etc.).

The program is installed on one physical server (computer). Operation Windows system 2008 server with installed SP.

To secure the robotic programs on the server, install the following and adjust the software security at the sequence assignment:

1. Database

1. MySQL database management server.

2. eTBManager database.

2. Addendum

1. JBOSS Java Application server for the eTBManager software.

2. Software eTBManager.

3. Web server

1. Apache HTTPD for accepting and processing web requests as cores.

2. Mod_jk connector for securing Apache HTTPD and JBOSS interoperability.

Everything you need to install the software, including the rest version software and training data base can be retrieved from ftp:.ua addresses anonymous access. Oskіlki vykoristovuetsya in the program security, the remaining versions can be taken from the site virobnіv. The rest of the versions avenge the correction of pardons and can be more stable, but they didn’t turn into nonsense.

9. Development of Web-technologies. Web 1.0, Web 2.0.

Web 1.0 - the first generation of "All-World Merazh", which won the TPC/IP protocol for the Internet. Yakshcho Dunternettivskka era, gloryed by the deprivation of the two-ovyniyani naviyazov, then with the arrival of Web (іnformasyno pavutini), Merezhev was withdrawn, peresonovati of Koristuvachi, and the resources of the resource Merezhi Web 1.0.

This period of development of Pavutini is characterized by the creation of static sites from HTML-hypertext links, passive transmission of information from the server to the client, the single-directed nature of the flow of information:

· The process of manual collection of information from resource creators to the server;

· Flow of passive distribution of information from the server to clients.

This period of vindication is that of a boisterous development electronic libraries, information catalogs on the Internet

Web 2.0 is an interactive "syntax" web, if there is a mass expansion of the dialog system, the resource is a core, the client is a server.

The purpose of the service-orientation of the Web, in which an interactive information process has developed between the server, the search system and electronic commerce.

The generation of the informational flow of the bula was placed in the hands of the koristuvachs themselves, and the rulers of the sites of the land were surrounded by the creation of that supporting infrastructure.

Information and search systems - their hyper-servers, robots and interfaces became the core of Pavutini. These algorithms for search, sorting, ranking and interface were based on the frequency-syntax analysis of information. roboti poke systemsє active explorers and passive moderators of the measure for the primary indexing of information.

10. Development of Web-technologies. Web 3.0, semantic web.

Web 3.0 is a semantic web (Semantic Web) - “a part of the global concept for the development of the Internet, which is a method of realizing the possibility of machine processing of information available from the All-World Web. The main emphasis of the concept is to fight on robots with metadata, which unambiguously characterize the power and wealth of resources All-World's Spider zamіst vikoristovuvannoy in the hour text analysis documents". Tobto - tse kakas merezha over Merezhey, scho to avenge the metadata about the resources of the All-World's Pawutin and in parallel with them. Based on automation information processes between servers.

It is possible to start using semantic tools: from the semantic layout of resources to the text to intelligent algorithms, like understanding the sense of human phrases.

Vinikli merezhevі, "hmarnі" calculus that take control of private information resources inside Pavutini's hyper-servers.

Technologies for creating web-sites have become thinner flooring, which is the bar for corystuvacs and creators information resources Mayzha decreased to zero, not depending on their everyday knowledge in the gallery of information technologies.

Sami mesh technologies up to the level of automatically functioning meshing on-line add-ons: interfaces for the creation of resources, semantic translators, exchangers of news, search engine analyzers and automatic formatting of central information bases.

Crim internal interserver interfaces, non-human interfaces with physical light: automatic selection of multimedia information, robotic software analysis of information hello world, according to the hyper-servers of Pavutini Roboti, go to the stage of active moderation of content, censors, which determine what can be published in Web 3.0, and what cannot.

11. Development of Web technologies. Web services.

Web service, web service (English web service) - identified by a web address software system with standardized interfaces. Web Services Can Interact One-to-One third-party programs for additional help, based on the same protocols (SOAP, XML-RPC, REST, etc.). A web service is the unit of modularity with a different service-oriented architecture of the program.

In web services, they call the services that rely on the Internet. For those who live, the term needs to be clarified, which means search, web mail, saving documents, files, bookmarks, etc. Such web services can be used independently from a computer, browser or access to the Internet.

REST (Representational state transfer) is a style of software architecture for distributed systems, such as the World Wide Web, which is called for inspiring web services. The term REST was developed by 2000 roci Roy Fielding, one of the authors of the HTTP protocol. Systems that support REST are called RESTful systems.

In the REST mode, we will simply use the interface to manage information without using additional internal proxies. A skin unit of information is uniquely identified by a global identifier, such as a URL. The skin of the URL, in its own way, may have a strict job format.

REST wiki to encourage Web services.

Apparently, a web service is an add-on that works on the World Wide Web and access to which is hoped for by the HTTP protocol, and the exchange of information goes for help XML format. Also, the format of the data that is transferred to the request will be XML.

For skin unit information, 5 days are indicated. And to herself:

GET /info/ (Index)- Remove the list of all objects.

GET /info/(id) (View)- take away new information about the object.

PUT /info/ or POST /info/ (Create)- Create a new object.

DELETE /info/(id) (Delete)– view data from the identifier (id).
As you can see, the architecture of REST is already simple in terms of vikoristannya. By the type of request, you can immediately determine what to rob, regardless of the formats (for SOAP, XML-RPC). Data is transferred without zastosuvannya of additional balls, so REST is considered to be less resourceful, it does not need to be powered up to understand that it is the responsibility of the work and it is not required to transfer data from one format to another.

12. HTTP protocol. The structure of a hypertext document. Main standards.

HTTP - a wide extension of the transfer protocol, a list of destinations for the transfer of hypertext documents (these documents, which can be avenged by force, allow organizing the transfer to other documents).

The HTTP protocol transfers a different client-server transfer structure. The client program forms a request and sends it to the server, after which the server software is processed Danish zapit, Form a confirmation and send it back to the client. If this client program can continue to overpower other requests, they will be completed with a similar order.

The structure of a hypertext document.

Pid hypertext document understand the text, which should cover the special elements, in case of transition to such a transition to another document. Qi elements are called hyperpowers And you can see the fragment of the text, buttons, little one. The force can be changed and for the transition to different divisions of the same document (in this case the force is called anchor or anchor).

Let's take a look at the structure of the HTML document. For a simple look, you can write її for such a look:







Save the document under the name index.html and display it in the browser. What are we doing? Nothing - an empty side. Let's take a look at the butt and it's important to remember.

HTML elements are tags. Tags - tse keywords, laid in the apex of the bow. Tags can be single (for example, horizontal characteristic


) or guys. In another way, the element is stacked from the tag that is displayed (for example, ) and the tag that closes (). The element range expands to the area between the tag that curves and closes.

The entire hypertext document is placed in the middle of the html element (to і). There are two more elements in the middle of the element - the title of the document (element head), which is used to remove service information about the document and the body of the document (element ), so as to remove information that appears in the window of the browser.

Induced structure sufficient for folding simple HTML documents for special purposes, but they do not comply with the standard. The head pardon is based on what is not specified, in what is the standard for the presentation of the document. The standard is written in the first row before the tag . We wonder what the main standards are.

For HTML 4.01

For XHTML 1.0

For XHTML 1.1

Strict, Transitional, Frameset - mean strict (layout is not guilty of mischief against the standard) specification, transitional (pardons are ignored, for dummies) that for sites, which are framed by frames (or else?). Specifying the type of document is case-sensitive, so it’s better to copy and paste examples here for unique pardons.

Establish other standards, to create a template, we name it on the first 3 list (you can easily modify the template for your document type).

Let's move on to the division of the title. The title of the page (title element), META-data and other service information are specified for the new one. Here we focus only on the title, the elements are visible in different topics (significantly less than two elements that are considered for coding that CSS).

Dodamo in the middle of the head element row Document structure that window of the browser. At the top of the top row of the browser, mimic those that you have entered in the middle of the title element. In addition, this information is reviewed by the browser for the purpose of understanding the message, if you add a side to the bookmarks.

For the correct interpretation of the side of my responsibility, we have to encode the spellings of our document. For whom add a row

Here we use the standard Windows coding windows-1251. Obviously, it’s not enough, it’s necessary, so that the document itself is typed in at any coding. Also standard є utf-8 encoding (unicode, which supports typing character extensions).

Also, the format for cascading style sheets for an additional row

The body of the document (the body element) to replace the visual information, that is. the one that is uninterruptedly displayed at the window of the browser. Dodamo row "Code of the document to correct the correct structure".

Also, the remaining variant (which we can win as a template for other documents) is coming:

Document structure Document code to correct the structure

From the results, we took away the document template for the opposite standard.

HTML5: Usі documents.

HTML 4.01: Suvorian HTML syntax. Transitional HTML syntax. Frames are featured in HTML documents.

XHTML 1.0: Suvori XHTML syntax. Transitional XHTML Syntax. The document is written in XHTML and has to be removed. XHTML mobile profile adds specific elements for mobile phones.

XHTML 1.1: There can't seem to be a similar subdivision, the syntax is the same and follows clear rules.

element assignments for inserting a flow document type - DTD (document type definition, document type description). It is necessary that the browser is smart, as a way to interpret the streaming web page, the HTML skeletons are available in decal versions, in addition, XHTML (Extensible HyperText Markup Language, the extension of the hypertext markup language), similar to HTML, but differ from it for the syntax. So that the browser “does not stray” and understands, according to some standard, display the web page and it is necessary to set the code in the first row .

Speaking of Apache, MySQL and PHP, most admins can use the LAMP stack, but they can install this set of software in one of the many Linux distributions. Tim choose FreeBSD for the time being, whichever you prefer, it might be more appropriate.

In this article, I’ll tell you about all the steps, which are necessary to overcome in order to launch FreeBSD at once with a stack of (L)AMP and decalcoma administration tools on a completely bare server and work so that everything works at once without any problems in that unforeseen situation.

Krok 1. Installing FreeBSD

For starters, we need the operating system itself. Let's go to the official side FreeBSD(www.freebsd.org), following the request of "Get FreeBSD Now", gave the choice of OS version (at the time of writing, there were two versions available: 8.2-RELEASE and 7.4-RELEASE), architecture (amd64 or i386), click on the and a list of available images. Usogo їх five: bootonly - zavantazhuvalny image for installation through merezh, disk1 - ISO image for burning to CD, dvd1 - image for burning to DVD, livefs - LiveCD without graphic interface, memstick for writing to a USB stick. In our case, only the first one and the other will be suitable, and if there is no DHCP server in the least, then only the other one (the DVD-image can't be downloaded to the senses, because the CD can avenge everything that we need).

Then, zavantazhuєmo ISO-image, arіzaєmo yogo on a blank, insert it into the drive of the server and drop / turn on yogo. Let's check the OS for the time being. After the end of the zavantazhennya on the screen, it will appear at the choice of the country and the menu of the sysinstall installer, which consists of twelve points. There is only one of them to click on us: “Express”, wine allows you to install the operating system as quickly as possible, skipping a lot of advanced reminders, power up and fix. Vibiraemo yogo, tisnemo .

Show up at a meeting to break the disk. Here you can just click for the transcription of the entire disc, or , to create a new division in the Vilniy region. However, in May, if FreeBSD's courtier disk partitioning scheme with a single standard DOS partition (slice in FreeBSD terminology) can replace a few BSD partitions, that one needs to create only one partition. After the end it's on pressure to exit the program.

Coming soon: information about the installation of a zavantazhuvacha, just embossed schob install zavantazhuvach at MBR. Soon after the new one will appear in the window of the maker of the created distribution for the BSD distribution. Here you can experiment, but I recommend bi just squeeze so that the program itself marked the disk. Dali tisnemo to confirm the change.

Coming soon: Vibir dzherela installation. By default, like a CD / DVD, it’s just embossed . Confirmation of vibir onslaught at the coming future. Now the process of copying the files will start, after which the screen will show the information about turning in the main menu of the installer. Onslaught , gave , "Yes" that . The operating system may be reset. Do not forget to remove the installation disk from the drive, so that the OS is taken from the hard disk.

After the completion of the capture, it is entered as root and access to the command interpreter is required.

Krok 2. Nalashtuvannya

Only a few have installed FreeBSD, but still not ready to take on the role of a full-time server: there is no merging, root does not have a password, there is only one koristuvach in the system. Let's fix it. Nasampered, set the root password:

Food will appear on the screen, for most of them you can not give advice (press ), important and less im'ya koristuvacha, default command interpreter (or rather choose tcsh) and password. For example, the command will display the list on the screen for setting the koristuvach, at the next prompt enter the word “yes”, and at the next prompt enter “no”.

Sob koristuvach zmіg take away root rights, dodamo yogo to the wheel group:

# pw groupmod wheel -m username

Let's fix the /etc/fstab file so that no one can run the files stashed on the /tmp and /var. For this dodamo parapori "noexec" in the field Options of the dermal branch.

Let's install a simple exchange for access to system files:

# chmod 0600 /etc/syslog.conf

chmod 0600/etc/rc.conf

chmod 0600 /etc/newsyslog.conf

chmod 0600 /etc/hosts.allow

chmod 0600 /etc/login.conf

Now we need to fix the borders of the day. In FreeBSD, all global settings are saved in the /etc/rc.conf file, so you can add the next row after the help of the editor:

#ee /etc/rc.conf
hostname="host.com"
ifconfig_em0="inet 1.2.3.4 netmask 0xffffffff"
defaultrouter="5.6.7.8"

Here em0 is in a different row - the name of the interfacing interface to be configured. The list of available interfacing interfaces can be viewed with the help of the ifconfig command. As the value of the option, you can specify DHCP, then the interface will be configured with dhclient. Also, I would like to add some options that are important for us:

#ee /etc/rc.conf

Including packet forwarding

register all try forwarding

icmp_drop_redirect="YES"
icmp_log_redirect="YES"

Blocking vidpovidi on a wide range of ping-requests

icmp_bmcastecho="NO"

Cleaning up the /tmp directory in case of a skin attack

clear_tmp_enable="YES"

The update to the /etc/motd file is blocked for the hour of the skin capture

update_motd="NO"

We do not accept packets with one-hour installation

ensigns SYN and FIN

tcp_drop_synfin="YES"

Vickajemo sendmail

sendmail_enable="NO"
sendmail_submit_enable="NO"

Enable SSH

sshd_enable="YES"

To get out of the editor, on the press and dvіchі . Dodamo the DNS server address in /etc/resolv.conf:

#ee /etc/resolv.conf
nameserver 8.8.8.8

To fix the fence and fix it, I’m going to step on the command:

# /etc/rc.d/netif retstart

We check the availability of the measure:

# ping execbit.ru

Adding a few brown rows to the /etc/sysctl.conf file:

#ee /etc/sysctl.conf

Do not accept connection to closed ports

(false against certain types of DoS attacks and reduce

port scanning)

net.inet.tcp.blackhole=2
net.inet.udp.blackhole=1

The list of all processes only root is allowed to be viewed

kern.ps_showallprocs=0

Protect SSH server against brute force attacks:

# echo "MaxStartups 5:50:10" >> /etc/ssh/sshd_config

/etc/rc.d/sshd restart

The SSH server will now show up 50% of new connections at times, which will break five bad registrations. If there are ten of them, the server will stop calling.

If you choose express installation, the ports system (a framework for installing third-party software in the OS) is not automatically installed on FreeBSD, so we need to do it manually (it’s good, so we take the best view of the ports so we don’t take revenge on the old, crappy software):

# portsnap fetch extract

It is also possible to update the base system, but not ob'yazkovo:

# freebsd-update fetch

freebsd-update install

shutdown -r now

In addition, as soon as the updates will be installed, we will install the rkhunter tool into the system, which is necessary for vilov rootkits, which can be installed into the system in the future:

# cd /usr/ports/security/rkhunter

make install clean

We edited the configuration file /usr/local/etc/rkhunter.conf so that the MAIL-ON-WARNING option sent email to some extent to notify about anomalies detected.

Let's change the tool for updating:

# rkhunter --update

Then we create a sign of system files, which will be victorious as soon as possible for a rootkit search:

# echo "daily_rkhunter_update_enable="YES"" > /etc/periodic.conf

echo "daily_rkhunter_check_enable="YES"" > /etc/periodic.conf

Everything, now all the notifications about suspected system activity are placed in the log /var/log/rkhunter.log and are forced to respond to the email configuration file.

# crontab -e 0 2 * * * root /usr/local/sbin/ntpdate pool.ntp.org

Let's install Webmin, a web-based interface for remote logging by the server (if you want to hack for SSH administration, you can skip this tutorial):

# cd /usr/ports/sysutils/webmin

make install clean

echo "webmin_enable="YES"" >> /etc/rc.conf

# /usr/local/lib/webmin/setup.sh

On the power supply, you can support the onslaught , however, if you are on the right to enter the password (row "Login password:"), then enter the password to access Webmin (in short, as it will be checked for other passwords). Then you can start Webmin:

# /usr/local/etc/rc.d/webmin start

І protest against this robot by entering the address "https://host.com:10000/" into the address bar of the nearest browser.

AMP

Now it's time to install the AMP stack, which is the Apache web server, the MySQL database, and the PHP interpreter. Let's start with Apache. I demo in the port and install the remaining version:

# cd /usr/ports/www/apache22

make config install clean

A configurator window will appear on the screen, for help you can choose the installation of optional server components. There is no way to change the sense here, you can boldly squeeze it . After completing the installation and installation, do not forget to add the server to autostart (as the SSL trim is not needed, you can skip the other row):

# echo "apache22_enable="YES"" >> /etc/rc.conf

echo "apache22ssl_enable="YES"" >> /etc/rc.conf

Also, before the configuration file, add instructions for capturing the accf_http module, which buffers the HTTP traffic, which will disable the server and help you fight SYN-flood:

# echo "accf_http_ready="YES"" >> /etc/rc.conf

kldload accf_http

# cd /usr/ports/lang/php5

make config install clean

Verify that the "Build Apache module" option is selected. Plus sprat expansion of something new:

# cd /usr/ports/lang/php5-extensions

make config install clean

It is important that you do not forget the MySQL database support item in the short PHP configuration, which will mute the port system before installing the PHP module for MySQL robots. Nothing is ordered without it.

Now you can open the Apache configuration file in a text editor (FreeBSD has far away locations: /usr/local/etc/apache22/ httpd.conf) and change it in a new step:

1. After the LoadModule rows, we add two rows:

AddType application/x-httpd-php.php
AddType application/x-httpd-php-source.phps

2. We know the ServerAdmin option and write down the value of your postal address:

ServerAdmin [email protected]

3. The DocumentRoot option specifies a directory where all the files of our website will be stored:

DocumentRoot "/home/www/data"

Don't forget to create this directory:

# mkdir /home/www

mkdir /home/www/data

mkdir /home/www/cgi-bin

I recognize the win as the root directory /home/www so, in the first place, the /home directory should be located on the largest distribution (the autoconfigurator of the distributions, which we victorious during the installation, enter the /home directory for most of the space), but -friend, it's easier to work with him, lower /usr/local/www/apache22/data, we'll save it from an anonymous directory.

4. We know the next row:

I change it so that the DocumentRoot was specified as a directory:

5. Change the next rows:


DirectoryIndex index.html


DirectoryIndex index.php index.html

6. Useful directives replace the row:

ScriptAlias ​​/cgi-bin/ "/usr/local/www/apache22/cgi-bin/"

Axis tsієї:

ScriptAlias ​​/cgi-bin/ "/home/www/cgi-bin/"

7. Next row:

Replacing the tsієyu:

Save the file and create the PHP file:

# cp /usr/local/etc/php.ini-recommended /usr/local/etc/php.ini

It will be sufficient for normal Apache work with PHP. You can now reinstall MySQL. Idemo in port and robimo like this:

# cd /usr/ports/databases/mysql50-server

make WITH_OPENSSL=yes install clean

Let's create a rudimentary configuration file, like a hack:

#ee /etc/my.cnf
port=29912
port=29912
bind-address=127.0.0.1

Dodamo MySQL to autoload and start the server:

# echo "mysql_enable="YES""<< /etc/rc.conf

/usr/local/etc/rc.d/mysql-server start

Set the password for access to the data base:

# mysqladmin -u root password password

mysql -u root -p

Now MySQL is responsible for normal functioning, but it’s not so easy to manage databases manually, until then, for some, it will be the first time to install MySQL, and it’s not so easy to get started with it. Let's install the MySQL web interface under the name PHPMyAdmin:

# cd /usr/ports/databases/phpmyadmin

make install clean

Let's fix the PHPMyAdmin configuration file by entering the password to access the web interface:

# cd /usr/local/www/phpMyAdmin

cp config.sample.inc.php config.inc.php

ee config.inc.php

$cfg["blowfi sh_secret"] = "password";

Now I'm reopening the Apache configuration file and working like this:

1. Section add the next row:

Alias ​​/phpmyadmin /usr/local/www/phpMyAdmin

2. For example sections add next rows:


order allow,deny
Allow from all

Here the "Allow from all" option can be added to the "Allow from 123.456.789.0/12" checkbox, to allow access to PHPMyAdmin only from the same directory. Restart Apache:

Tse everything that now (L)AMP is guilty of pratsyuvati.

HTTPS

PHPMyAdmin for correct operation will require HTTPS support, and as much as possible, you may need this protocol in your future to establish a secure encrypted connection between the client and the site. That's why we need Apache yoga rozumiv.

For the first time, we corrected the OpenSSL configuration file (/etc/ssl/openssl.cnf), adding to the next row:

# Catalog for obtaining certificates
dir=/root/sslCA

Term for a certificate (~10 years)

default_days = 3650

Now we are preparing a catalog and creating a certificate for the authority certification center:

mkdir sslCA

chmod 700 sslCA

chmod 700 sslCA

mkdir private

cd sslCA

openssl req -new -x509 -days 3650 -extensions v3_ca

Keyout private/cakey.pem -out cacert.pem
-config /etc/ssl/openssl.cnf

Verify that the certificates were created successfully:

# ls -l cacert.pem private/cakey.pem

Generate a certificate for Apache and place it in the /etc/ssl directory:

# cd /root/sslCA

openssl req -new -nodes -out hostname-req.pem

Keyout private/hostname-key.pem -config /etc/ssl/openssl.cnf

openssl ca -config g /etc/ssl/openssl.cnf -out

im'ya host-cert.pem -infiles im host-req.pem

cp /root/sslCA/im_host-cert.pem /etc/ssl/crt

cp /root/sslCA/private/hostname-key.pem /etc/ssl/key

I’m revisiting the Apache configuration file, we know the next row and commenting it out:

# ee /usr/local/etc/apache22/httpd.conf

Include etc/apache22/extra/httpd-ssl.conf

We make the following changes to the /usr/local/etc/apache22/extra/http-ssl.conf file:

# ee /usr/local/etc/apache22/extra/http-ssl.conf

HTTPS server name

ServerName ssl.host.com

The way to the file, scho to check the certificate and the key

SSLCertificateFile /etc/ssl/crt/yourhostname-cert.pem
SSLCertificateKeyFile /etc/ssl/key/yourhostname-key.pem

Those same, scho th at the head confіzі

DocumentRoot "/home/www/data"

Where to write logs

ErrorLog "/var/log/httpd-error.log"
TransferLog "/var/log/httpd-access.log"

Restart Apache:

# /usr/local/etc/rc.d/apache22 restart

What did you give?

In this article, I have shown how I will renew the (L)AMP stack on the basis of FreeBSD (so it’s better for FAMP), and everything that you now need to rob, seize your favorite website engine and burn yoga to the /home/ directory www /data (don't forget to put the scripts in /home/www/cgi-bin). Reshta vіzme vіn (L)AMP.

LAMP stack is the foundation for Linux hosted websites is the Linux, Apache, MySQL and PHP (LAMP) software stack.

LAMP Stand for:-

  1. L (LinexOS)
  2. A(Apache[ Local Client Server])
  3. M (MySQL Database)
  4. P (PHP)

A LAMP Stack is a set of Open-source software that can be used to create websites and web hosts. LAMP is an acronym, and reserves typically consist of Linux operating system, Apache HTTP Server, MySQL relative database management system, and PHP programming language.

    linux: Operating system (OS) makes up our first layer. Linux press on foundation for stack model. All other letters go on the upper part of the letter. Linux is the lowest-level layer and provides the operating system. Linux actually runs each of the other components. You are not specifically limited to Linux, however; You can speed up all other components on Microsoft®; Windows®;, Mac OS X, or UNIX® if you need to.

    apache: The second layer consists of web server software, typically Apache Web Server. This person is found in the upper part of the Linux literature. Web servers are the best for translating web browsers to their correct websites. Apache provides the technique to render a Web page to a user. Apache is a stable, mission-critical-capable server, and it runs more than 65 percent of all Web sites on the Internet. The PHP components that are currently being developed in Apache, and you will win Apache and PHP together to create your dynamic sides.

    MySQL: Your thirty years є, de є databases live. MySQL stores details that can be queried by scripting to construct a website. MySQL should be hosted on the top of the Linux layer for Apache/layer 2. On higher hosts, MySQL may be offloaded to a separate host server. MySQL takes care of the data-storage side of the LAMP system. With MySQL, you can access some of the simpler data that is important for running great and complex jobs. Without your web hosting, all your data, products, accounts, and other types of information will be placed in this document in a format that you can write in SQL language.

    PHP: Images on the upper part of the їх є all chotiri and the rest of the rocks. The image should lie before PHP and/or other similar programs. Websites and Web Applications run within this layer. PHP is a simple and efficient programming language that provides glue for all thether parts of the LAMP system. You've tweaked PHP to develop Dynamic content capable of accessing the data in the MySQL database and some of the features that Linux provides.


The LAMP stack (Linux/apache/mysql/php) is the most common set of technologies for building websites. With the knowledge that we may, we have developed a sample of ready-made VDS images for easy development on them for mini hosting, oriented to work in LAMP. The overarching principle in the development of these images was to ensure the same type of installation, if sites placed on one VDS were easily moved to another VDS, to be based on another image (another set of basic software) and all the main administrative tasks of any VDS based on from the proponated images were beaten in the same way. We also wrote, which is more important, that adding new sites to the server was not more complicated, it was just creating a folder with the names of the site. As a result, we created on the basis of distributions Debian Wheezy, Ubuntu Precise Pangolin and Ubuntu Trusty Tahr with the upcoming set of software:

  • Nginx + Apache2 + PHP 5.4 (FastCGI) + MariaDB 5.5 + phpMyAdmin + sftp
  • Nginx + Apache2 + PHP 5.4 (mod_php) + MariaDB 5.5 + phpMyAdmin + sftp
  • Nginx + PHP 5.4 (php-fpm) + MariaDB 5.5 + phpMyAdmin + sftp

1. A formal description of the finished images

All the images prompted the appearance of the fact that the main and the only coristuvach in the system, in the name of which scripts are practiced and all other divi, buv coristuvach web. Similar to the order of speeches adopted in Ubuntu, in images based on Debian, the direct robot under the name of root is not allowed (blocked) and the root of the web via sudo is given the ability to win commands with the privileges of a supercorist. In this way, to enter the new VDS from ssh, you need to enter the command:

$ssh [email protected]

For ssh login, the sftp protocol is also supported. The connection is carried out with the same web login and either with a password, which is the same as when generating the VDS, or with an additional key, so the very specified time of the VDS creation.

After logging in, you will find yourself in the folder /var/www/web, which is the main folder for our VDS images. Here you will find the sites folder - this is the folder in which your sites will be placed. To add a new site, enough in the middle of the sites folder, create a subfolder with the names of the new site without the www prefix. . Report about the price below.

Logs for hosting your apache sites will be written to the /var/log/apache2 folder, and nginx, as installed, to the /var/log/nginx folder. For example, if PHP-scripts have pardons in robots, information about them is written in the file /var/www/web/php-errors.log

2. Adding sites

Adding websites- the operation is most often requested for mass shared hosting, so we tried to make it as simple as possible. To add a new site mycompany.ru to your server, you need to add two simple ones:

  1. For paps /var/www/web/sites, you need to create a subfolder with the name mycompany.ru, so that the name of the domain without www. . Vseredinі tsієї folders nadіbno bude vykladat scripts, scho lie to the site.
  2. Through the DNS editor at your provider, which gives you the service of parking a domain in the DNS, you will need to add an A-record to indicate on the ip-address of your VDS: one for the name mycompany.ru, another one for www.mycompany.ru.

Adding an alias(alternative name for your website) It's no less a simple operation. If you need to add the alias www.mycompany.ru to the site mycompany.ru, then you need all the following:

  1. Create a symbolic link (symlink): cd /var/www/web/sites && ln -s mycompany.ru www.mycompany.ru
  2. Create A-records in DNS that indicate on the IP address of your server: for the name c www. the one without www.

We remind you that the domain parking service at dns is free for all our clients and without borders. Instructions for delegating domains to our ns-servers

3. Robot with MySQL (MariaDB)

For newly created VDS, the password for access to a short root MySQL is generated by a double rank. You can find out the password with the command

sudo cat /root/.my.cnf

If you want to access MySQL from the console, then just run the command sudo -H mysql without parameters and immediately enter the password into the MySQL console without having to enter a password. If such a system setting does not control you, you can safely delete the .my.cnf file, saving your entries in a new password in advance.

The file for customization of MySQL layouts in the standard location, but for editing you need the rights of the supercoder:

sudo nano /etc/mysql/my.cnf

To change the rank, you need to restart MySQL:

sudo service mysql restart

4. Set up PHP and set extension

The standard PHP is installed in the system from the Debian/Ubuntu repositories, the PHP installation and the installed extension are carried out in the standard way for debian based distributions. The php.ini file is taken from a number of warehouse parts: from the main php.ini and instead of the conf.d directory. For the FastCGI version of PHP, installations are taken from the /etc/php5/cgi folder, for mod_php - from the /etc/php5/apache2 folder, for the CLI version (/usr/bin/php , then this version of php, other commands that are displayed in the console) - /etc/php5/cli. The php-fpm version is based on the php.ini version from the /etc/php5/fpm folder.

You can easily see which php extensions are installed on your system by entering the following command in the server console:

$dpkg-l | grep php

You can look through the list of available php extensions with the command:

$ apt-cache search php5

Before the first cycle of apt-cache/apt-get commands on a new system, don't forget to type sudo apt-get update .

Installing the required extension from the list is even easier. Perhaps we want to add the XCache accelerator to the system. The default package is named php5-xcache , and the command to install it, which will give you the privileges of the supercache, would be:

$ sudo apt-get install php5-xcache

PHP shards, starting from version 5.4, instead of explicitly specifying the time zone in the settings (date.timezone), the UTC time zone is set behind the lock. This setting is specified in the /etc/php5/apache2/conf.d/local.ini file. You need to change it її apparently to your likeness.

In any case, if you blame the power of your system on the basis of our ready-made images, you can always go back to our technical support.

5. Running Django with uWSGI Help

Django (Django) is a powerful framework that allows you to quickly and easily expand dynamic Python web programs.

    The installation is completed in such a way that it does not disrupt the operation of sites, spreading at /var/www/

    Dії servers are iconized under the name of the root.

Show installation instructions

5.1 Installing packages and launching uWSGI

We install the necessary packages for the robot, and also select the version of uwsgi with pip as the version for locking:

apt-get update && apt-get install -y python-pip python-dev uwsgi-plugin-python uwsgi && pip install virtualenv virtualenvwrapper uwsgi && update-alternatives --install /usr/bin/uwsgi uws uwsgi 80

The installation requires 2-3 files and the installed packages will take about 300 MB on disk.

Let's make a mess in the system, switch to a new one, and also add another change to the system profile

Useradd -s /bin/bash -m -p $(pwgen -1 -N 1) project1 && su - project1 -c "echo "export WORKON_HOME=~/Env" >> ~/.bashrc && echo "source /usr/ local/bin/virtualenvwrapper.sh" >> ~/.bashrc" && su-project1

Let's create a virtual polish, install it in new django and create our project

Cd ~ && mkvirtualenv firstsite && pip install django && django-admin.py startproject firstsite

For the sake of transparency, we create a file for the project

Touch ~/firstsite/touch_reload

Send the uwsgi command to re-read the configuration to the project. It might be better if the project is handled by a non-root specialist without root access to the server - the server administrator will not need to log in as root to restart uwsgi.

Let's turn back to the root session by pressing the Ctrl+D keys.

Now let's make configuration file uwsgi for our project

Mcedit /etc/uwsgi/apps-enabled/firstsite.ini

І copied into the new one (it is not necessary to make changes before the copied text):

Project = firstsite userhomedir = /home/project1 chdir = %(userhomedir)/%(project) home = %(userhomedir)/Env/%(project) module = %(project).wsgi:application processes = 4 threads = 2 chown -socket=www-data uid=project1 gid=project1 vacuum=true touch-reload=%(userhomedir)/%(project)/touch_reload buffer-size=8192 listen=128 harakiri=300

For savings in mcedit just press F2 on the keyboard.

Run uwsgi server

/etc/init.d/uwsgi start

5.2 Creating a config file for nginx

We will need to know the IP address of the server. Yogo can marvel after winning the team

Hostname-I

Let's create the config file for nginx

medit /etc/nginx/sites-available/firstsite

I remember yogo with the coming text

Server ( listen serverip:80; server_name sitenameru; location = /favicon.ico ( access_log on; log_not_found off; ) location /static/ ( root /home/project1/firstsite; ) location / ( include uwsgi_params; uwsgi_pass un run/uwsgi/ app/firstsite/socket; ))

For this configuration file, you need to change serverip to the IP address of your server, and sitenameru - to the name of the domain, according to which your project is viewed.

We activate the creation of the configuration file and send the nginx signal to reread the configuration

Ln -s /etc/nginx/sites-available/firstsite /etc/nginx/sites-enabled/ && nginx -s reload

Ready! If the DNS entry for the sitenameru domain is set to the IP address of the server, then your project is already at fault for being accessible by the sitenameru address.

5.3 Optimizing the rendering of static files

If the project will be taken advantage of and it will be necessary to optimize static files, it will be enough for the command

Su - project1 workon firstsite

Finishing the firstsite/firstsite/settings.py file with a riddle about stashing static files

echo "STATIC_ROOT = os.path.join(BASE_DIR, "static/")" | tee -a ~/firstsite/firstsite/settings.py

Run the script for collecting static files

~/firstsite/manage.py collectstatic

For the cob of the script, it is necessary to abuse yes.

© 2022 androidas.ru - All about Android