Last active
January 16, 2018 01:27
-
-
Save tadeubdev/9ed3f8b6fb395496846672d940b7cc94 to your computer and use it in GitHub Desktop.
Starting with webdev on Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. The first file contains manual to create an enviroment of development. | |
| 2. After install all items go to second file to create your first virtualhost (using the second file in one of steps). | |
| 3. The third file has content to make an vhost in second step! | |
| 4. Return to second step everytime when you need a new vhost ;) | |
| You're finished! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo su | |
| # put pass to root | |
| apt update | |
| apt install nginx | |
| apt install apache2 | |
| # install mysql | |
| apt install mysql-server | |
| # set and reapeat admin password for mysql | |
| # installing php version 7.1 | |
| add-apt-repository ppa:ondrej/php | |
| apt update | |
| apt install php7.1 php7.1-fpm php7.1-common php7.1-mysql php7.1-mcrypt php7.1-xml php7.1-mbstring | |
| phpenmod mysqli | |
| phpenmod mcrypt | |
| phpenmod mbstring | |
| # instalar sublimet text 3 | |
| add-apt-repository ppa:webupd8team/sublime-text-3 | |
| apt update | |
| apt install sublime-text-installer | |
| # install vscode | |
| # go to: https://code.visualstudio.com/Download | |
| # and get last file (32/64bit).deb | |
| cd ~/Downloads/ | |
| dpkg -i <code_path>.deb | |
| apt install -f | |
| apt update | |
| apt install code | |
| apt install git | |
| apt install nodejs | |
| ln -s /usr/bin/nodejs /usr/bin/node | |
| apt install npm | |
| npm cache clean -f | |
| npm install -g n | |
| n stable | |
| ll /usr/local/n/versions/node/ | |
| ln -sf /usr/local/n/versions/node/<VERSION>/bin/node /usr/bin/nodejs | |
| # npm install -g bower | |
| # npm install -g gulp | |
| apt install curl | |
| curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - | |
| echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list | |
| apt-get update && apt-get install yarn | |
| yarn global bin | |
| export PATH="$PATH:/home/{user}/.yarn/bin" | |
| yarn global add gulp | |
| yarn global add bower | |
| # composer | |
| php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
| php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" | |
| php composer-setup.php | |
| php -r "unlink('composer-setup.php');" | |
| mv ./composer.phar /usr/bin/composer | |
| apt autoremove | |
| # alterar php.ini | |
| subl /etc/php/7.1/fpm/php.ini | |
| # find 'cgi.fix_pathinfo', remove '#' and ';', alter 1 to 0 value | |
| # create link in /var/www | |
| mkdir -p ~/vhosts | |
| sudo ln -s ~/vhosts /var/www/vhosts | |
| # you're finished! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # replace php version (7.1) and vhost name (helloworld.local) | |
| # puting vhost in hosts file | |
| sudo subl /etc/hosts | |
| # put: 127.0.0.1 teste.local | |
| sudo subl /etc/nginx/sites-available/helloworld.local.conf | |
| # get data of server.conf | |
| mkdir -p ~/vhosts/helloworld.local/ | |
| echo '<?php phpinfo(); ?>'>> ~/vhosts/helloworld.local/index.php | |
| sudo ln -s /etc/nginx/sites-available/helloworld.local.conf /etc/nginx/sites-enabled/helloworld.local.conf | |
| # restart all services | |
| sudo service apache2 stop | |
| sudo service nginx restart | |
| sudo service php7.1-fpm restart | |
| sudo service apache2 start | |
| sudo service apache-htcacheclean restart | |
| sudo service mysql restart | |
| clear |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| listen 80; | |
| server_name helloworld.local; | |
| root /var/www/vhosts/helloworld.local; | |
| index index.html index.htm index.php; | |
| charset utf-8; | |
| location / { | |
| try_files $uri $uri/ /index.php?$query_string; | |
| } | |
| location = /favicon.ico { access_log off; log_not_found off; } | |
| location = /robots.txt { access_log off; log_not_found off; } | |
| access_log off; | |
| error_log /var/log/nginx/helloworld.local.app-error.log error; | |
| error_page 404 /404.php; | |
| sendfile off; | |
| location ~\.php$ { | |
| fastcgi_split_path_info ^(.+\.pp)(/.+)$; | |
| fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; | |
| fastcgi_index index.php; | |
| include fastcgi_params; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| fastcgi_intercept_errors on; | |
| fastcgi_buffer_size 16k; | |
| fastcgi_buffers 4 16k; | |
| } | |
| location ~/\.ht { | |
| deny all; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment